I'm using git on a new project that has two parallel -- but currently experimental -- development branches:
(我在一个新项目上使用git,该项目有两个并行的但目前仍处于试验阶段的开发分支:)
exp1
and exp2
represent two very different architectural approaches.
(exp1
和exp2
代表两种非常不同的体系结构方法。)
Until I get further along I have no way of knowing which one (if either) will work. (直到我步入正轨,我才知道哪一个(如果有的话)会工作。)
As I make progress in one branch I sometimes have edits that would be useful in the other branch and would like to merge just those. (当我在一个分支中取得进展时,有时我会进行一些编辑,而这些编辑在另一分支中将非常有用,并且希望将这些合并。)
What is the best way to merge selective changes from one development branch to another while leaving behind everything else?
(将选择的更改从一个开发分支合并到另一个开发分支,同时又保留其他所有分支的最佳方法是什么?)
Approaches I've considered:
(我考虑过的方法:)
git merge --no-commit
followed by manual unstaging of a large number of edits that I don't want to make common between the branches.
(git merge --no-commit
然后手动取消暂存我不想在分支之间共享的大量编辑。)
Manual copying of common files into a temp directory followed by git checkout
to move to the other branch and then more manual copying out of the temp directory into the working tree.
(手动将常用文件复制到temp目录中,然后git checkout
移至另一个分支,然后从temp目录中进行更多手动复制到工作树中。)
A variation on the above.
(上面的变化。)
Abandon the exp
branches for now and use two additional local repositories for experimentation. (现在放弃exp
分支,并使用另外两个本地存储库进行实验。)
This makes the manual copying of files much more straightforward. (这使得手动复制文件更加简单。)
All three of these approaches seem tedious and error-prone.
(所有这三种方法似乎都是乏味且容易出错。)
I'm hoping there is a better approach; (我希望有更好的方法;)
something akin to a filter path parameter that would make git-merge
more selective. (类似于filter path参数,可以使git-merge
更具选择性。)
ask by David Joyner translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…