Re: [PATCH 4/5] status: show the ref that is checked out, even if it's detached

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Duy Nguyen <pclouds@xxxxxxxxx> writes:

>> 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 commit

your @{-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}.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]