Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #101 from alphagov/git-force-with-lease
Browse files Browse the repository at this point in the history
Update force recommendations to include --force-with-lease
  • Loading branch information
NickColley authored Apr 10, 2017
2 parents 78c3d9b + 383416f commit 6395a10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ push *all* remote-tracking branches.

So, if you ever need to force push the 'foobar' branch, please instead do

$ git push -f origin foobar
$ git push --force-with-lease origin foobar

`--force-with-lease` refuses to update a branch unless it is the state that we expect; i.e. nobody has updated the remote branch.
See: https://developer.atlassian.com/blog/2015/04/force-with-lease/

You can also change git's default behaviour of pushing all tracked branches by
doing `git config --global push.default upstream`, but you should probably get
Expand Down

0 comments on commit 6395a10

Please sign in to comment.