Documentation/git-push.txt: explain better cases where --force is dangerous
The behavior of "git push --force" is rather clear when it updates only one remote ref, but running it when pushing several branches can really be dangerous. Warn the users a bit more and give them the alternative to push only one branch. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthieu Moy committed
Jun 17, 2013 at 19:52 UTC
70495b556f5685afe0e41988e42d48b2331d77a0
1 file changed
+9
Documentation/git-push.txt
+9
@@ -124,6 +124,15 @@ no `push.default` configuration variable is set.
124
not an ancestor of the local ref used to overwrite it.
125
This flag disables the check. This can cause the
126
remote repository to lose commits; use it with care.
127
+ Note that `--force` applies to all the refs that are pushed,
128
+ hence using it with `push.default` set to `matching` or with
129
+ multiple push destinations configured with `remote.*.push`
130
+ may overwrite refs other than the current branch (including
131
+ local refs that are strictly behind their remote counterpart).
132
+ To force a push to only one branch, use a `+` in front of the
133
+ refspec to push (e.g `git push origin +master` to force a push
134
+ to the `master` branch). See the `<refspec>...` section above
135
+ for details.
136
137
--repo=<repository>::
138
This option is only relevant if no <repository> argument is