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

流过昼夜 提交于 2019-12-18 05:07:07

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/7599707/checkout-the-git-commit-corresponding-to-a-certain-revision-from-the-old-svn-rep

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!