Re: [PATCH/RFC v4 3/3] branch: add copy branch feature implementation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 6, 2017, 00:14 UTC
- Message-ID
- <xmqqh8zu9dl2.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <xmqqlgp69ds9.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> When somebody says "I want to rename my current branch to X", it is
> clear that the person wants to end up being on a branch called X.
>
> To me, "I want to copy my current branch to Y" sounds more like "I
> want to create another Y that looks just like the current branch,
> but I want stay on my current branch".
>
> If you think copy makes @{-1} problematic, perhaps your copy is
> doing more than it should (e.g. switching the current branch at the
> same time, or something).A related tangent. Git does not assign any identity to a branch, so "the branch we were previously on" goes strictly by name. If you are on branch X, switched to branch Y, and then renamed branch X (which is not current) to branch Z, Git will still think that the previous branch is X, so an attempt to switch back to @{-1} may do unexpected things.