How do I show the SVN revision number in git log?

Consider the command git svn

  • it has a similar log function than git log: git svn log
  • it has the find-rev option (to retrieve the SVN revision from a SHA1 key) (introduced in git 1.6.0)

I am not sure of you can combine those two options in one command line though.
A script (a bit like this one which is not exactly what you want but still can give some idea) might be in order.


sdaau adds in the comments:

An example of this:

git svn find-rev $(git log --max-count 1 --pretty=format:%H)

Adversus adds in the comments:

Note that find-rev searches in the current branch, so if you’re in master and rxyz happened in a branch, find-rev will not find it.
You can give -B (before) or -A (after) options for a wider search, see git svn find-rev man page section.

Leave a Comment