当合并不可能时,是否可以将一些提交移动到另一个分支?

Is it possible to move some commits to another branch when merge is impossible?

我是新来的,希望有人能帮助我解决我的(也许很简单?)git 问题:

我在我的主分支上做了一个提交(说“1”)。 然后我在我的 bugfix 分支上对提交“2”进行了更改。

然后我添加了更多提交,“3”、“4”、“5”、“6”,它们应该在 master 上,但它们在 bugfix 上,它们不属于那里。

合并似乎不可能,因为“2”不应该在 master 上。

所以我有

(master) 1
............. |
(bugfix) 2-3-4-5-6

我想要

(master) 1-3-4-5-6
............. |
(bugfix) 2

提前谢谢你:)

基本的解决方法:

# bring into master what should have been
git checkout master
git cherry-pick 3 4 5 6

# then rewind bugfix to its original scope
git checkout bugfix
git reset --hard 2