Re: Is current HEAD pointing at a given revision ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Francis Moreau <francis.moro@xxxxxxxxx> writes:

> I have a given revision (tag, sha1 ...) and I'd like to know if that
> revisions corresponds to what the current HEAD is pointing at.
> 
> Could anybody give me some advices for achieving this ?

If you want to know if given revision (or ref) points at the same
thing as HEAD, you can use

  [ "$(git rev-parse HEAD)" = "$(git rev-parse $ref^{commit})" ]

or something like that.  The '^{commit}' is here in case $ref points
only indirectly to commit, via a tag object.

If you want to kow if current HEAD is tagged, you can use instead

  git describe --exact-match HEAD

-- 
Jakub Narebski
Poland
ShadeHawk on #git
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]