简体   繁体   English

从Subversion迁移到Git如何在给定修订号的情况下找到提交?

[英]Migrating from Subversion to Git how can I find a commit given a revision number?

Migrating from Subversion to Git using svn2git (which internally uses git-svn) I'd like to know how I can find a specific revision commit. 使用svn2git(内部使用git-svn)从Subversion迁移到Git我想知道如何找到特定的修订提交。

It is quite common to have issues tracker to have comments like: "Fixed in r12345". 让问题跟踪器有类似的评论很常见:“在r12345中修复”。

Given this, I'd like to be able, for example, to extract the diff corresponding to r12345. 鉴于此,我希望能够提取对应于r12345的差异。

Thanks in advance. 提前致谢。

Regards 问候

Given the revision number, you can find the Git SHA with 鉴于修订号,您可以找到Git SHA

git svn find-rev r1938

I don't know if there's a "one-shot" way to get the commit or anything, but you can write something like 我不知道是否有“一次性”的方式来获取提交或任何东西,但你可以写一些像

git log -p `git svn find-rev r1938`

Update: note that you can also grab the commit message with 更新:请注意,您也可以使用获取提交消息

git svn log -r 1938

Update again: note that find-rev also works in reverse: 再次更新:请注意, find-rev也可以反向运行:

git svn find-rev c7443021942

returns the SVN commit number. 返回SVN提交号。

With Git it's similar: 与Git类似:

Fixed in d8602bb9729ddb2f28e61028cc5981cb310231a2.

Get the diff with: 得到差异:

git show d8602bb9729ddb2f28e61028cc5981cb310231a2

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

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