是否可以让 Git 知道 SVN 的修订?
使用 git-svn 时,Git 将 SVN 修订版与各个提交相关联。
大多数其他团队成员在希望对其代码进行审查时都会引用 SVN 修订版。 是否有可能让 Git “感知” SVN 修订版并将它们隐式转换为 Git 哈希值? 或者也许有一种方法可以公开 Git 提交和 SVN 修订之间的映射,以便我可以自己编写一个可以利用它的工具?
理想情况下我想做这样的事情:
$ git diff r12000 e0a4f09 # r12000 is SVN revision, e0a4f09 is Git hash
When using git-svn, Git associates SVN revision with individual commits.
Most of other team members quote SVN revisions when they want their code reviewed.
Is it possible to some how make Git 'aware' of the SVN revisions and implicitly convert them to Git hashes?
Or perhaps is there a way to expose the mapping between Git commits and SVN revisions, so that I can write myself a tool that could leverage that?
Ideally I would like to do something like:
$ git diff r12000 e0a4f09 # r12000 is SVN revision, e0a4f09 is Git hash
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git-svn 工具有一个转换选项,可以通过 SVN 修订版查找 git 对象,反之亦然。此选项可以按如下方式使用:
因此,您的 diff 命令可以是:
与其他答案相反,这也应该适用于分支和标签。
有关详细信息,请参阅有关此命令的 git-svn 手册页。
The git-svn tool has a conversion option to find the git object if by a SVN revision, or the other way around. This option can be used as follows:
Thus, your diff command could be:
As opposed to the other answer, this should also work with branches and tags.
For further information, see the manpage of git-svn on this command.