Documentation/git-push.txt: explain better cases where --force is dangerous
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Mon, 17 Jun 2013 17:52:41 +0000 (19:52 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Jun 2013 14:35:48 +0000 (07:35 -0700)
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>
Documentation/git-push.txt
index 8b637d339f522e9dd6f3310efdc0691c5bcb14bf..28a17c34ff1d3f418e8ec55c61b0a492ec6d5a30 100644 (file)
@@ -124,6 +124,15 @@ no `push.default` configuration variable is set.
        not an ancestor of the local ref used to overwrite it.
        This flag disables the check.  This can cause the
        remote repository to lose commits; use it with care.
+       Note that `--force` applies to all the refs that are pushed,
+       hence using it with `push.default` set to `matching` or with
+       multiple push destinations configured with `remote.*.push`
+       may overwrite refs other than the current branch (including
+       local refs that are strictly behind their remote counterpart).
+       To force a push to only one branch, use a `+` in front of the
+       refspec to push (e.g `git push origin +master` to force a push
+       to the `master` branch). See the `<refspec>...` section above
+       for details.
 
 --repo=<repository>::
        This option is only relevant if no <repository> argument is