Re: git push default behaviour?
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:15
Matthieu Moy [off-list ref] writes:
Junio C Hamano [off-list ref] writes:quoted
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: ... If someone else did a push between my first push and the "push --force", then the other user's push is discarded.
That is exactly what I said in the parentheses above, isn't it? The danger of "--force" does not have anything to do with which branches are pushed. It comes primarily from the use of shared repository. The first advice Carlos gave us in this thread, which was perfectly sane, applies to your observation: before you "push --force", think twice. That does not change the conclusion that current is more suitable for shared repository workflow and matching is more (not "equally to current") suitable for publishing repository workflow, and we have a way for user to tell Git which one is being used in a particular project exactly for that purpose.