From: Ævar Arnfjörð Bjarmason Date: Wed, 21 Jul 2010 11:32:49 GMT Subject: Re: git name-rev for fun and profit (Re: [PATCH] t/: work around one-shot variable assignment with test_must_fail) Message-ID: In-Reply-To: <20100721010539.GF4282@burratino> On Wed, Jul 21, 2010 at 01:05, Jonathan Nieder wrote: > Ævar Arnfjörð Bjarmason wrote: > >> As an aside, how do you make these 61-commits-after-rc0 commit ids. Is >> there a sha1->that tool that I haven't spotted? > >  GIT_PAGER_IN_USE=1 git log --all-match --grep=shell --grep=export | >  git -p name-rev --tags --stdin > > v1.5.6-rc0~61 is 61 commits before rc0 (well, the 61st-generation > grandparent using the first parent where there is a choice).  The > distinction matters because “61 commits _after_ 1.5.6-rc0” is not > well-defined. Thanks, added that as an alias in my .gitconfig: abbrev-commit = "!f() { git name-rev --tags \"$@\" | sed 's|.*tags/||;s|\\([0-9a-f]\\{7\\}\\).*|\\1|'; }; f" > If you want the latter sort of description anyway, ‘git describe’ > might help. git describe was actually more like what I wanted. I'd used it before, but forgotten it. Thanks.