Re: 'git branch' when origin branch with same name exists
- From
- Ryan Lortie <desrt@desrt.ca>
- Date
- Jun 19, 2012, 20:44 UTC
- Message-ID
- <4FE0E493.1010308@desrt.ca>
- In-Reply-To
- <7v8vfj17de.fsf@alter.siamese.dyndns.org>
hi,
On 12-06-19 02:31 PM, Junio C Hamano wrote:
Show 7 quoted lines
> But I do not think "git branch" can sensibly and > correctly make that decision for the user---at least I do not sense > any of the people who is in this thread has clear idea on what to > base that decision on, and "the same name appears in an existing > remote" is not it. "The same name appears, and the new branch is > not set to integrate with it" may be closer, but that may forbid > valid use cases too much.
My originally intended point was that it should be prevented in the case where 'git branch' is given no additional arguments (ie: implicitly creating the branch from HEAD). Obviously it should be possible to create a 'gtk-3-4' branch that is based on the origin one. In any case, I should have made that more clear.
So to restate the feature request more clearly: "git branch X" with no explicitly specified start-point should prevent the branch "X" from being created when a branch with the same name already exists on a remote (perhaps only considering 'origin').
When stated in this more explicit way, it becomes clear that a --force option would not even be required; you could just say:
git branch gtk-3-4 HEAD
to make it clear that this was your intention.
Nobody making a casual mistake would type that in full.
Cheers