From: J. Bruce Fields Date: Thu, 22 Feb 2007 20:47:37 GMT Subject: Re: How to say HEAD~"all the way back - 1" Message-ID: <20070222204737.GC18622@fieldses.org> In-Reply-To: <7vodnmdk8y.fsf@assigned-by-dhcp.cox.net> On Thu, Feb 22, 2007 at 12:12:45PM -0800, Junio C Hamano wrote: > Sorry, there is no such shorthand, but you could obviously say: > > $ git rev-list --parents HEAD | grep -v ' ' > > A way to find the root commit seems to be one of the things > people new to git want at least once, once they start futzing > with the tool. But I suspect that is only because they need > that information to see how the tool works (say "what different > output would I get out of 'git show $commit' for root and other > commits?"), and not because they need that information for any > real life use. > > Really, what useful purpose does it serve for you to find out > the root commit, OTHER THAN being able to say "the development > history of this project starts at this commit"? I occasionally want to reference commits not relative to "all the way back" but to "all the way back on this branch". So, e.g., what's the next-to-last commit before "topic" meets up with "origin"? I can do something like git rev-list origin..topic | tail -2 | head -1 but in practice it's faster just to fire up gitk origin.. and cut-n-paste object id's. --b.