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

* Re: [PATCH] Documentation/git-push.txt: explain better cases where --force is dangerous
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-17 19:36 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, philipoakley, artagnon

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> 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>
> ---

Looks good.  Thanks.


>  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

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

* Re: [PATCH] Documentation/git-push.txt: explain better cases where --force is dangerous
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Marc Branchaud @ 2013-06-17 21:09 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, gitster, philipoakley, artagnon, marcnarc

On 13-06-17 01:52 PM, Matthieu Moy wrote:
> 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

s/destination/destinations/

		M.

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

* Re: [PATCH] Documentation/git-push.txt: explain better cases where --force is dangerous
  2013-06-17 21:09 ` Marc Branchaud
@ 2013-06-17 21:38   ` Junio C Hamano
  2013-06-18  7:42     ` Matthieu Moy
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2013-06-17 21:38 UTC (permalink / raw)
  To: Marc Branchaud; +Cc: Matthieu Moy, git, philipoakley, artagnon

Marc Branchaud <marcnarc@xiplink.com> writes:

> On 13-06-17 01:52 PM, Matthieu Moy wrote:
>> 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
>
> s/destination/destinations/

Good eyes.

After I re-read the one, I found that "override" somewhat a strange
expression.  There is nothing that overrides or to be overriden.

How about putting it like this?

 Documentation/git-push.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 8b637d3..21294aa 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -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 push out 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

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

* Re: [PATCH] Documentation/git-push.txt: explain better cases where --force is dangerous
  2013-06-17 21:38   ` Junio C Hamano
@ 2013-06-18  7:42     ` Matthieu Moy
  2013-06-18 14:35       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Matthieu Moy @ 2013-06-18  7:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Marc Branchaud, git, philipoakley, artagnon

Junio C Hamano <gitster@pobox.com> writes:


> After I re-read the one, I found that "override" somewhat a strange
> expression.  There is nothing that overrides or to be overriden.

Right, I actually meant "overwrite".

> How about putting it like this?

I'm not sure "push out refs other than the current branch" is strong
enough. Once you are used to "push = fast-forward = can't loose data",
"push out a ref" is not very scary.

I'd do s/push out/overwrite/, but I'm fine with your version too.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] Documentation/git-push.txt: explain better cases where --force is dangerous
  2013-06-18  7:42     ` Matthieu Moy
@ 2013-06-18 14:35       ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-18 14:35 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Marc Branchaud, git, philipoakley, artagnon

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>
>> After I re-read the one, I found that "override" somewhat a strange
>> expression.  There is nothing that overrides or to be overriden.
>
> Right, I actually meant "overwrite".
>
>> How about putting it like this?
>
> I'm not sure "push out refs other than the current branch" is strong
> enough. Once you are used to "push = fast-forward = can't loose data",
> "push out a ref" is not very scary.
>
> I'd do s/push out/overwrite/, but I'm fine with your version too.

OK, I agree that it makes sense to do that substitution.
Will queue.

^ permalink raw reply	[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).