> > 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 bcdd637033297a35cd06bba2a6b0fe96d8fa330e % git rev-parse v1.7.1^ 34c071aea4aed9db484eca21c12dd443888f43ec 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 name): % git rev-parse v1.7.1^{commit} d599e0484f8ebac8cc50e9557a4c3d246826843d % git rev-parse v1.7.1^0 d599e0484f8ebac8cc50e9557a4c3d246826843d 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. -- Chris -- 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 git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.