Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:18

Duy Nguyen [off-list ref] writes:
quoted
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}.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help