Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkout the git commit corresponding to a certain revision from the old SVN repository?

I migrated my repository from SVN to git. I used THIS site. Now I have a bug in revision X. How do I checkout from my git repository, knowing only the revision number from my old SVN repo?

Thank you for your Help.

like image 650
Iron Avatar asked Feb 23 '23 20:02

Iron


1 Answers

You can find the git commit that corresponds to the Subversion revision with the git svn find-rev subcommand. For example, if you're looking for the commit that corresponds to Subversion revision 3431 you can do:

$ git svn find-rev r3431
42ed8bcf690fd0c655c5cee91b09258318fc56e8

Then, to checkout that revision, just use the object name from the first line, e.g. if it's:

commit 42ed8bcf690fd0c655c5cee91b09258318fc56e8
Author: torstenrohlfing <torstenrohlfing@42a5c34f-2066-0410-bec5-ba365beb4995>
Date:   Fri Sep 9 17:11:38 2011 +0000

    FIX: do not update time stamps on pre-existing files that did not get updated.


    git-svn-id: https://www.nitrc.org/svn/cmtk/trunk@3431 42a5c34f-2066-0410-bec5-ba365beb4995

You can do:

git checkout 42ed8bcf69

... to try that revision. (Note that this will detach HEAD, so if you don't know what that means, it would be worth searching for "detached HEAD" first :))

like image 113
Mark Longair Avatar answered Feb 26 '23 06:02

Mark Longair