Re: A new way to get a sha1?
- From
Martin Langhoff <martin.langhoff@gmail.com>
- Date
- Jul 30, 2012, 18:16 UTC
- Message-ID
- <CACPiFCKxYdF8G33myfjOXU31cDWrfrtedve8m89tH_tfOCZ4ng@mail.gmail.com>
- In-Reply-To
- <7vipd5s161.fsf@alter.siamese.dyndns.org>
On Mon, Jul 30, 2012 at 11:45 AM, Junio C Hamano <gitster@pobox.com> wrote:
> git show -s ':/^t1100-.*: Fix an interm'
That doesn't work for me (git 1.7.10.4 as per Fedora 18 rpms) in git.git. But the idea is sound -- git can give you the sha1 trivially. You don't need additional glue.
But any ref definition can be turned into a sha1 with this snippet:
git show --pretty=format:%H HEAD
If you want to get the last 10 sha1s, use the same "pretty" with git log
git log --pretty=format:%H HEAD | head
This is all predicated on passing the info to something else. For git commands, you can always use the rich ref notation git supports.
cheers,
m
-- martin.langhoff@gmail.com martin@laptop.org -- Software Architect - OLPC - ask interesting questions - don't get distracted with shiny stuff - working code first - http://wiki.laptop.org/go/User:Martinlanghoff