简体   繁体   English

从旧的SVN存储库中检出对应于某个修订版的git commit?

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

I migrated my repository from SVN to git. 我将我的存储库从SVN迁移到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? 现在我在修订版X中有一个错误。如何从我的git存储库中检出,只知道我原来的SVN回购中的版本号?

Thank you for your Help. 谢谢您的帮助。

You can find the git commit that corresponds to the Subversion revision with the git svn find-rev subcommand. 您可以使用git svn find-rev子命令git svn find-rev与Subversion修订版对应的git commit。 For example, if you're looking for the commit that corresponds to Subversion revision 3431 you can do: 例如,如果您正在寻找与Subversion版本3431相对应的提交,您可以执行以下操作:

$ git svn find-rev r3431
42ed8bcf690fd0c655c5cee91b09258318fc56e8

Then, to checkout that revision, just use the object name from the first line, eg 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 :)) (注意,这将分离HEAD,所以如果你不知道这意味着什么,那么首先值得搜索“分离的HEAD”:))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM