Re: Bug: git checkout @{u} breaks git branch if the upstream isn't a local branch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 22, 2019, 05:02 UTC
- Message-ID
- <xmqq7ecrqz65.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CAGRskv__Qe-F-grBtq5v-uhHE+BQAcAcOQtX-GKB+MNOrxs0hQ@mail.gmail.com>
Leszek Swirski <leszeks@google.com> writes:
Show 5 quoted lines
> I assume that either the reflog entry should be amended to print
> something more informative (moving from master to origin/master, or at
> least master@{u}, or the SHA...), or the reflog search in
> wt_status_get_detached_from should do something cleverer with relative
> refs.Nicely analyzed. A record "moving to @{u}" in the reflog may not leave sufficient information for a later operation to tell what branch was refered to with the @{u} reference back when "checkout" was run. I suspect that checking out @{4}, @{1.day.ago}, etc. may share the same issue.
"git checkout @{-1}" aka "git checkout -" may not have any problem after such a checkout, as it only uses "moving from" side of the reflog entry.