Re: [PATCH 4/5] status: show the ref that is checked out, even if it's detached
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 4, 2013, 15:49 UTC
- Message-ID
- <7v38wbxizi.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CACsJy8A+gw9oJYrJqa-b8noKM7qJTkZEd7ovmxqR68i6miCatA@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 10 quoted lines
>> Instead of punting to "Currently not on any branch", would it help
>> to show the place you first detached at, so that the user can then
>> grab that commit object name and run
>>
>> $ git log --oneline $that_commit..
>>
>> or something?
>
> $that_commit would be HEAD@{-1} right? Should that be used instead of
> grabbing random SHA-1 shown in git-status?You can say "git checkout @{-1}" to go back. That is the commit you came _from_.
But I think what you were computing for $that_commit was different. It's "the ref that is checked out, even if it's detached".
After doing:
: start from anywhere
git checkout master ;# on master
git checkout branch~4 ;# detach at that commit
... hack hack hack ...
git commit; git commityour @{-1} is 'master'; "the ref that is checked out, even if its' detached" is 'branch~4', and that is what you want as $that_commit in the example. That shows your _progress_, which has no relation with 'master' that is @{-1}.