Re: [PATCH] config doc: rewrite push.default section
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 17, 2013, 14:31 UTC
- Message-ID
- <7vsj0ghkqt.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <vpqip1d803r.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> But then the place to warn loudly is the doc for --force. What about > this?
Sounds sensible. I am not sure if "--all" is all that common to be singled out, though. "I always push these out" refspecs, like
[remote "origin"]
push = refs/heads/master
push = refs/heads/nextshare the need for the same cautiousness against --force, and "applies to all the refs that are pushed" already covers both.
Mentioning 'matching' here is a very good idea, as people may not realize it is pushing out more than the current branch.
Show 38 quoted lines
> ------- 8< ------- 8< ------- 8< ------- 8< ------- 8< ------- 8< > > From a529588dd8df84e54e5ec267068248cc555373f5 Mon Sep 17 00:00:00 2001 > From: Matthieu Moy <Matthieu.Moy@imag.fr> > Date: Mon, 17 Jun 2013 13:02:39 +0200 > Subject: [PATCH] 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> > --- > Documentation/git-push.txt | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt > index 938d1ee..0899a35 100644 > --- a/Documentation/git-push.txt > +++ b/Documentation/git-push.txt > @@ -136,6 +136,13 @@ 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 `git push --all --force`, or `git push --force` > + with `push.default` set to `matching` 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 `git push <remote> +<branch>` instead of > + `--force`. > > --repo=<repository>:: > This option is only relevant if no <repository> argument is > -- > 1.8.3.1.495.g13f33cf.dirty