是否可以让 Git 知道 SVN 的修订?

发布于 2024-12-12 20:20:08 字数 305 浏览 4 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤蝉 2024-12-19 20:20:08

git-svn 工具有一个转换选项,可以通过 SVN 修订版查找 git 对象,反之亦然。此选项可以按如下方式使用:

git svn find-rev rSVNID

因此,您的 diff 命令可以是:

git diff $(git svn find-rev r12000) e0a4f09

与其他答案相反,这也应该适用于分支和标签。

有关详细信息,请参阅有关此命令的 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:

git svn find-rev rSVNID

Thus, your diff command could be:

git diff $(git svn find-rev r12000) e0a4f09

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文