开发者

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

开发者 https://www.devze.com 2023-04-10 00:51 出处:网络
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 on开发者_开发百科ly the revision number from my old SVN r

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 on开发者_开发百科ly the revision number from my old SVN repo?

Thank you for your Help.


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 :))

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号