Thread (5 messages) flat view 5 messages, 4 authors, 2016-06-15

Re: Commiting automatically (2)

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:50:17

Please try to not cull Cc list (use 'reply via email', if possible)

Maaartin [off-list ref] writes:
I let the snapshot point to the current head, which is where I get a problem now:

  git show-ref HEAD

returns nothing,

  git show-ref --head

returns HEAD and all branches and tags. Isn't it a bug? How can I get the HEAD 
reference? I'm using git version 1.7.2.3 on cygwin.
You can use `git rev-parse --verify HEAD`, for example.  Generally
scripted commands (including those in contrib/examples/) are good
sources of inspiration.  Or if you want symbolic name, you can use
`git symbolic-ref HEAD` or `git rev-parse --symbolic-full-name HEAD`.

As for `git show-ref HEAD` - git-show-ref uses its own way of pattern
matching; in new enough version of git-show-ref manpage you can read
that:

  <pattern>...::

        Show references matching one or more patterns. Patterns are matched from
        the end of the full name, and only complete parts are matched, e.g.
        'master' matches 'refs/heads/master', 'refs/remotes/origin/master',
        'refs/tags/jedi/master' but not 'refs/heads/mymaster' nor
        'refs/remotes/master/jedi'.

So `git show-ref HEAD` would match 'refs/.../HEAD`, e.g. `refs/remotes/origin/HEAD`,
but not `HEAD` which is outside `refs/`.

I tripped over strange git-show-ref <pattern> semantic too.

P.S. there is also git-for-each-ref.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help