git-svn合并2个svn分支 [英] git-svn merge 2 svn branches
问题描述
我正在使用svn。我有两个分支,他们都进行了很多变化。
除了其中一个分支之外,很多文件都被重命名了,所以现在svn无法帮助我合并这些文件中的更改(众所周知svn限制)。
- 是否有可能使用git-svn来执行合并分支?
- git-svn是否也会处理重命名的文件?
谢谢 //www.kernel.org/pub/software/scm/git/docs/git-merge.htmlrel =noreferrer> git merge
应该能够检测到(到某一点)重命名。
递归
这只能使用3-way合并算法解析两个头。
此外,这可以检测并处理涉及重命名的合并。
这是拉取或合并一个分支时的默认合并策略。
但 git-svn
可以只从SVN中导入/导出/到SVN,而不是合并。
合并很棘手:
<为了简单起见,以及与功能较弱的系统(SVN)进行互操作,建议所有
git svn 用户直接从SVN服务器克隆,获取并提交dcommit,并避免git存储库和分支之间的所有git clone / pull / merge / push操作。
推荐的方法在git分支和用户之间交换代码是git format-patch和git am,或者只是'dcommit'到SVN仓库。
运行git merge或git pull不是建议在您计划从中提交的分支机构。 Subversion不代表任何合理或有用的合并方式;因此使用Subversion的用户无法看到您所做的任何合并。另外,如果你从SVN分支镜像的git分支合并或拉出,dcommit可能会提交到错误的分支。
如果你合并,注意以下规则:git svn dcommit将尝试在
git log --grep = ^ git-svn-id:--first-parent -1
因此,您必须确保您要提交的分支的最近提交是合并的第一个父代。否则混沌会随之而来,特别是如果第一个父代在同一个SVN分支上是较旧的提交。
I'm using svn. I have two branches and on both of them were performed a lot of changes. In addition of one of the branches a lot of files were renamed, so now svn can not help me merge changes in those files (well know svn limitation).
- Is it possible using git-svn to perform the merge of the branches?
- Will git-svn handle renamed files too?
Thanks
git merge
should be able to detect (up to a certain point) renames.
recursive
This can only resolve two heads using a 3-way merge algorithm.
Additionally this can detect and handle merges involving renames.
This is the default merge strategy when pulling or merging one branch.
But git-svn
can only import/export from/to SVN, not do the merge.
And the merge is tricky:
CAVEATS
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 recommended method of exchanging code between git branches and users is git format-patch and git am, or just 'dcommit'ing to the SVN repository.Running git merge or git pull is NOT recommended on a branch you plan to dcommit from. Subversion does not represent merges in any reasonable or useful fashion; so users using Subversion cannot see any merges you've made. Furthermore, if you merge or pull from a git branch that is a mirror of an SVN branch, dcommit may commit to the wrong branch.
If you do merge, note the following rule: git svn dcommit will attempt to commit on top of the SVN commit named in
git log --grep=^git-svn-id: --first-parent -1
You must therefore ensure that the most recent commit of the branch you want to dcommit to is the first parent of the merge. Chaos will ensue otherwise, especially if the first parent is an older commit on the same SVN branch.
这篇关于git-svn合并2个svn分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!