使用git-svn将svn分支合并回trunk和trunk到分支中 [英] Using git-svn to merge a svn branch back into trunk and trunk back into the branch

查看:388
本文介绍了使用git-svn将svn分支合并回trunk和trunk到分支中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个svn TRUNK,看起来像这样:

  ABCD 



一个svn bug_fixes分支在提交B或C分支:

  -cdefghi 

现在我需要将我的svn分支中的cdefghi提交回主分支。



I 'm意识到我可以做一个压扁的提交,我们称之为squash SQUASH(其中会包含cdefghi),但是接下来好像我必须杀死bug_fixes分支并启动一个新的分支以干净地继续。



这里: http://blog.red -bean.com/sussman/?p=92 他们建议:

结帐分支。



合并主人对分支的更改



结帐主人。



merge --reintegrate 分支变更到master上。



继续开发。



不幸的是,git-svn似乎无法识别svn的任何merge --reintegrate命令。



那么我该如何干净地让分支和主人拥有所有提交,以便使用git-svn的命令来继续开发这两种方法?

解决方案

警告部分> git-svn 文档警告


为简单起见,建议所有 git svn 用户克隆 fetch dcommit 直接从SVN服务器获取,并避免所有 git clone / pull / merge / push git仓库和分支之间的操作。 p>

作者提供了一个建议:


在git分支和用户之间交换代码的推荐方法是 git format-patch git am ,或者只是 dcommit 到SVN仓库。

适应您的情况

  git format-patch --stdout c ^ .. i> my.patch 
git reset --hard trunk
git am< my.patch

其中 c i 是历史提交的适当标识符。


So I'm using git and interacting with an svn repo.

I have a svn TRUNK that looks like this:

A-B-C-D

And a svn bug_fixes branch that branches off at commit B or C:

 -c-d-e-f-g-h-i

Now I need to get the cdefghi commits that are in my svn branch back into the master branch.

I'm aware that I could just do a squashed commit, let's call it squash SQUASH (which would contain cdefghi), but then it seems like I would have to kill the bug_fixes branch and start a new branch to cleanly continue.

Here: http://blog.red-bean.com/sussman/?p=92 they suggest:

checkout the branch.

merge master's changes into the branch.

Checkout the master.

merge --reintegrate the branch's changes onto master.

Continue development.

Unfortunately, git-svn doesn't seem to recognize any "merge --reintegrate" command for svn.

So how do I cleanly make branch and master have all commits, so that development on both can continue, using git-svn's commands?

解决方案

The Caveats section of the git-svn documentation warns

For the sake of simplicity and interoperating with a less-capable system (SVN), it is recommended that all git svn users clone, fetch and dcommit directly from the SVN server, and avoid all git clone/pull/merge/push operations between git repositories and branches.

The author does provide a recommendation:

The recommended method of exchanging code between git branches and users is git format-patch and git am, or just dcommiting to the SVN repository.

Adapting to your situation

git format-patch --stdout c^..i >my.patch
git reset --hard trunk
git am <my.patch

where c and i are appropriate identifiers for the commits in your history.

这篇关于使用git-svn将svn分支合并回trunk和trunk到分支中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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