Re: git push default behaviour?

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: git push default behaviour?

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:53:15

Junio C Hamano [off-list ref] writes:
If you publish to your own repository
and let others pull, the behaviour is not dangerous at all with or
without --force (well, --force brings its own danger but that does
not have anything to do with which branches are pushed).  If you
default to 'current' in such a workflow, you risk forgetting to
push, which is the more dangerous option between the two.
Forgetting to push a branch is a danger, but far less dangerous than
what "push --force" can do in a shared repository.

In a shared repository, there's actually a race condition that you
cannot avoid AFAICT:

$ git push
 # get an error about non-fast-forward on branch A, but no other.
 # thing "it's OK, I do want to do a forced update on A".
$ git push --force

If someone else did a push between my first push and the "push --force",
then the other user's push is discarded.

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

Re: git push default behaviour?

From: Andreas Krey <hidden>
Date: 2016-06-15 22:53:15

On Thu, 08 Mar 2012 19:35:51 +0000, Matthieu Moy wrote:
...
If someone else did a push between my first push and the "push --force",
then the other user's push is discarded.
A push --semiforce would help here: Should check whether the remote
branch is at the same commit as origin/master locally, and only then set
to new local master. (Would probably require protocol change to actuall
be atomic.)

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help