从旧的 SVN 存储库中检出与某个修订版相对应的 git commit? [英] Checkout the git commit corresponding to a certain revision from the old SVN repository?

查看:38
本文介绍了从旧的 SVN 存储库中检出与某个修订版相对应的 git commit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的存储库从 SVN 迁移到了 git.我用了这个 网站.现在我在修订版 X 中有一个错误.我如何从我的 git 存储库中签出,只知道我旧 SVN 存储库中的修订版号?

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?

感谢您的帮助.

推荐答案

您可以使用 git svn find-rev 子命令找到对应于 Subversion 修订版的 git commit.例如,如果您要查找对应于 Subversion 修订版 3431 的提交,您可以执行以下操作:

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

你可以这样做:

git checkout 42ed8bcf69

... 尝试修改.(请注意,这将分离 HEAD,因此如果您不知道这意味着什么,则值得首先搜索分离的 HEAD":))

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

这篇关于从旧的 SVN 存储库中检出与某个修订版相对应的 git commit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆