Re: git name-rev for fun and profit (Re: [PATCH] t/: work around one-shot variable assignment with test_must_fail)
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 21, 2010, 11:32 UTC
- Message-ID
- <AANLkTil38MCB--6J0jOPk_0aVTPLWNM-PA318zHZu8xx@mail.gmail.com>
- In-Reply-To
- <20100721010539.GF4282@burratino>
On Wed, Jul 21, 2010 at 01:05, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 12 quoted lines
> Æ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.