Duy Nguyen <pclo...@gmail.com> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to