Skip to content

Commit bd54df0

Browse files
committed
Merge branch 'mm/push-force-is-dangerous' into maint
* mm/push-force-is-dangerous: Documentation/git-push.txt: explain better cases where --force is dangerous
2 parents 52c1999 + 70495b5 commit bd54df0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Documentation/git-push.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ already exists on the remote side.
136136
not an ancestor of the local ref used to overwrite it.
137137
This flag disables the check. This can cause the
138138
remote repository to lose commits; use it with care.
139+
Note that `--force` applies to all the refs that are pushed,
140+
hence using it with `push.default` set to `matching` or with
141+
multiple push destinations configured with `remote.*.push`
142+
may overwrite refs other than the current branch (including
143+
local refs that are strictly behind their remote counterpart).
144+
To force a push to only one branch, use a `+` in front of the
145+
refspec to push (e.g `git push origin +master` to force a push
146+
to the `master` branch). See the `<refspec>...` section above
147+
for details.
139148

140149
--repo=<repository>::
141150
This option is only relevant if no <repository> argument is

0 commit comments

Comments
 (0)