Re: Show current SHA1

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Show current SHA1

From: Teemu Likonen <hidden>
Date: 2016-06-15 22:47:02

On 2009-07-11 10:39 (+0100), Allan Kelly wrote:
The question then is: what is the command to report the current SHA1?
Note I never branch in the HTML repo, it's entirely linear.
If the "current SHA1" means "the SHA1 of the most recent commit in the
current branch" then usually

    git show

is the simplest way. There are many ways to print _only_ the SHA1.
Examples:

    git log -1 --pretty=format:%H
    git rev-list -1 HEAD

Re: Show current SHA1

From: Charles Bailey <hidden>
Date: 2016-06-15 22:47:02

On Sat, Jul 11, 2009 at 12:55:17PM +0300, Teemu Likonen wrote:
On 2009-07-11 10:39 (+0100), Allan Kelly wrote:
quoted
The question then is: what is the command to report the current SHA1?
Note I never branch in the HTML repo, it's entirely linear.
If the "current SHA1" means "the SHA1 of the most recent commit in the
current branch" then usually

    git show

is the simplest way. There are many ways to print _only_ the SHA1.
Examples:

    git log -1 --pretty=format:%H
    git rev-list -1 HEAD
For listing a single commit, I usually think of show and rev-parse
before using commands that list multiple commits. (Of course, having
to use --quiet doesn't make show any shorter than log -1.)

    git rev-parse HEAD
    git show --quiet --pretty=format:%H

-- 
Charles Bailey
http://ccgi.hashpling.plus.com/blog/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help