title: How can I decorate a git log with its nearest tag?
body: <p><code>git log --decorate</code> adds information about related refs to the log output:</p>
  
  <pre><code>commit 9e895ace5d82df8929b16f58e9f515f6d54ab82d (tag: v3.10-rc7)
  Author: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
  Date:   Sat Jun 22 09:47:31 2013 -1000
  
      Linux 3.10-rc7
  </code></pre>
  
  <p>This information helps tracking which tag (or branch) contains this commit. When viewing a restricted set of files (say, a subdirectory), there does not have to be a tag for those commits. Is there a way to put a reference to a tag in the log output?</p>
  
  <p>I previously mentioned <code>git describe</code>, but that yields <code>v3.10-rc7-135-g98b6ed0</code> which is relative to a tag of branch where this change was committed. What I am looking for is a tag name between commits.</p>
  
  <p>For clarity, this is the current situation:</p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>What I want to have is something like:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Using <code>git describe</code>'s output instead of the commit hash would show something like:</p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>As you can see, older tag names are used as reference point rather than the point where the commit got merged. For illustation purposes, I am using <code>git log --oneline</code> here, but I actually want to use fuller output, e.g. <code>git log -p --stat</code>.</p>