svn中如何移植补丁
我曾经使用 git 在不同分支之间移植功能,rebase
、rebase --onto
、cherry-pick
是我使用的典型工具。但现在我必须使用svn。我不喜欢使用 svn 内置的 merge
命令,因为它会将所有提交合并为一个“合并提交”,尽管在 1.5 之后具有一些历史可追溯性。假设我在 branchA
中有一系列从 r100 到 r110 的提交,现在我想通过重播这些功能将此功能移植到 branchB
和 branchC
使用相同的提交注释逐一提交(解决之间的任何冲突)。有没有任何自动工具可以为我做到这一点?
I used to use git to port features between different branches, rebase
, rebase --onto
, cherry-pick
are typical tools I used. But now I have to work with svn. I don't like to use svn's built in merge
command, cause it will combine all the commits into one "merge commit", though with some history traceability after 1.5. Say if I have a range of commits from r100 to r110 in branchA
, now I want to port this feature to branchB
and branchC
by replaying these commits one by one with the same commit comment (resolve any conflicts in between). Is there any automatic tool which can do this for me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道有任何自动化工具可以执行此操作,但您可以按照与 git rebase 相同的方式实现一个工具。它所做的只是创建一个临时目录,并使用 git format-patch 来提取您想要变基的更改,然后 git am 将它们应用回目标根目录。如果您在系统上输入
locate git-rebase
,您就可以读取它——它是一个 shell 脚本。它可能是 /usr/local/libexec/git-core/git-rebase 。svn
等效项将使用svn diff
和svn log
来保存原始提交信息,后跟patch
和>svn 提交
。I don't know of any automated tool to do this, but you could implement one along the same lines of
git rebase
. All it does it make a temporary directory and usegit format-patch
to to extract the changes you want to rebase and thengit am
to apply them back to the target root. If you typelocate git-rebase
on your system you can read it -- it's a shell script. It's probably/usr/local/libexec/git-core/git-rebase
.The
svn
equivalent would usesvn diff
andsvn log
to save the original commit information followed bypatch
andsvn commit
.如果可以的话,请使用
git-svn
。令人敬畏的git
历史记录不会出现在中央存储库中,但您将有更好的时间来管理您的工作。If you can, use
git-svn
. The awesomegit
history won't be in the central repo, but you'll have a much better time managing the work on your end.