> > Anyone have a good way to do likewise, but get the date of the last
> > commit as of the tag, instead of the date the tag was created?

On May 26, 10:49 am, Konstantin Khomoutov <khomou...@gmail.com> wrote:
> I suspect it's as simple as using
> $ git show 1.0.0^
> that is, referencing the first (and only) parent of the tag object.

Not quite. Plain "^" works on commit objects, not tag objects. So
"tagname^" is interpreted in a way similar to “we need to find a
parent (^), so interpret the preceding part (tagname) as a commit,
then find its first parent”. This means you get the first parent of
the tagged commit, not the tagged commit itself.

In a git.git clone:

    % git log -2 --oneline v1.7.1
    d599e04 Git 1.7.1
    34c071a Merge branch 'maint'
    % git rev-parse v1.7.1
    % git rev-parse v1.7.1^

There is a syntax for what the original poster wants though. The full
syntax is  "tagname^{commit}", but "tagname^0" is a shortcut version.

Also in git.git (see earlier output to match up the SHA-1 object

    % git rev-parse v1.7.1^{commit}
    % git rev-parse v1.7.1^0

Thus, to "git show" just commit under a "1.0.0" tag:

    git show 1.0.0^0

But, if the date is the only bit of information of interest, there is
an easier way to extract just the date(s) from the commit under a tag.

    % git log -1 --pretty=tformat:%ad v1.7.1
    Fri Apr 23 18:27:17 2010 -0700
    % git log -1 --pretty=tformat:%cd v1.7.1
    Fri Apr 23 18:27:17 2010 -0700

Note that since "git log" works with commits, it will automatically
dereference tag names (or other refs) into their underlying commit.

The first (%ad) extracts the author date and the second (%cd) extracts
the committer date. These are often the same, but may differ in
commits made by cherry picking, rebasing, or when using a patches-over-
email type workflow. Also, if the dates are going to be immediately
parsed by some other program, then --date=raw might also be useful.


You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to