git log --decorate adds information about related links to log output:
commit 9e895ace5d82df8929b16f58e9f515f6d54ab82d (tag: v3.10-rc7) Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Sat Jun 22 09:47:31 2013 -1000 Linux 3.10-rc7
This information helps you track which tag (or branch) contains this commit. When viewing a limited set of files (say, a subdirectory) for these commits, it is not necessary to be a tag. Is there a way to place a link to a tag in the output log file?
I mentioned git describe earlier, but this gives v3.10-rc7-135-g98b6ed0 , which refers to the tag of the branch where this change was made. What I'm looking for is the tag name between commits.
For clarity, this is the current situation:
$ git log --decorate --oneline 98b6ed0 (HEAD, origin/master, master) Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 1a506e4 Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux 578a131 dlci: validate the net device in dlci_del() 11eb264 dlci: acquire rtnl_lock before calling __dev_get_by_name() ... 9e895ac (tag: v3.10-rc7) Linux 3.10-rc7
I want to have something like:
98b6ed0 (v3.10-rc7+, HEAD, origin/master, master) Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 1a506e4 (v3.10-rc7+) Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux 578a131 (v3.10-rc7+) dlci: validate the net device in dlci_del() 11eb264 (v3.10-rc7+) dlci: acquire rtnl_lock before calling __dev_get_by_name() ... 9e895ac (tag: v3.10-rc7) Linux 3.10-rc7
Using git describe output instead of the commit hash will do the following:
$ git log --decorate --oneline -n4 | awk '{system("git describe " $1 " |tr -d '\''\n'\''");$1="";print}' v3.10-rc7-135-g98b6ed0 (HEAD, origin/master, master) Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net v3.10-rc7-54-g1a506e4 Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux v3.10-rc6-81-g578a131 dlci: validate the net device in dlci_del() v3.10-rc6-80-g11eb264 dlci: acquire rtnl_lock before calling __dev_get_by_name() ... v3.10-rc7 (tag: v3.10-rc7) Linux 3.10-rc7
As you can see, older tag names are used as a breakpoint, not the point at which the command was merged. For illustration purposes, I use git log --oneline here, but I really want to use more complete output, for example. git log -p --stat .