git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Documentation/git-push.txt: explain better cases where --force is dangerous
@ 2013-06-17 17:52 Matthieu Moy
  2013-06-17 19:36 ` Junio C Hamano
  2013-06-17 21:09 ` Marc Branchaud
  0 siblings, 2 replies; 6+ messages in thread
From: Matthieu Moy @ 2013-06-17 17:52 UTC (permalink / raw)
  To: git, gitster; +Cc: philipoakley, artagnon, Matthieu Moy

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>
---
 Documentation/git-push.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 938d1ee..9b9e7d1 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -136,6 +136,14 @@ already exists on the remote side.
 	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 destination configured may override 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
-- 
1.8.3.1.495.g13f33cf.dirty

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-18 14:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-17 17:52 [PATCH] Documentation/git-push.txt: explain better cases where --force is dangerous Matthieu Moy
2013-06-17 19:36 ` Junio C Hamano
2013-06-17 21:09 ` Marc Branchaud
2013-06-17 21:38   ` Junio C Hamano
2013-06-18  7:42     ` Matthieu Moy
2013-06-18 14:35       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).