Is there a way to push to a branch only if it hasn't changed since I last fetched it?
More specifically, I'd like to delete branches that have already been merged, but only if no one else pushes new commits to them between when I check that the branch has been merged and when I push the deletion.
From the git push
documentation, I see that it does support a --atomic
option, but that option is for making updates to multiple branches atomically with respect to each other, rather than for ensuring that my update to a remote branch will be atomic with respect to other users' updates.
Ie, I want to delete merged branches on a remote git repository without any risk of deleting anyone else's work, even if they are working concurrently.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…