From: Junio C Hamano Date: Mon, 04 Mar 2013 15:49:53 GMT Subject: Re: [PATCH 4/5] status: show the ref that is checked out, even if it's detached Message-ID: <7v38wbxizi.fsf@alter.siamese.dyndns.org> In-Reply-To: Duy Nguyen 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}.