Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating from Subversion to Git how can I find a commit given a revision number?

Migrating from Subversion to Git using svn2git (which internally uses git-svn) I'd like to know how I can find a specific revision commit.

It is quite common to have issues tracker to have comments like: "Fixed in r12345".

Given this, I'd like to be able, for example, to extract the diff corresponding to r12345.

Thanks in advance.

Regards

like image 431
Patrick Allaert Avatar asked Jun 07 '10 13:06

Patrick Allaert


1 Answers

Given the revision number, you can find the Git SHA with

git svn find-rev r1938

I don't know if there's a "one-shot" way to get the commit or anything, but you can write something like

git log -p `git svn find-rev r1938`

Update: note that you can also grab the commit message with

git svn log -r 1938

Update again: note that find-rev also works in reverse:

git svn find-rev c7443021942

returns the SVN commit number.

like image 174
Will Robertson Avatar answered Oct 07 '22 19:10

Will Robertson