我有3个分支,m
是master的头,而g
和h
是单个提交分支。我目前无法进行变基或合并。我想要的是在母版的顶部选择g
和h
中的更改,而无需提交它们,而只是取消暂存它们。这3个之间没有冲突。但是,我只能选择g
或h
。当我尝试选择另一个时,选择失败:
error: your local changes would be overwritten by cherry-pick.
hint: commit your changes or stash them to proceed.
fatal: cherry-pick failed
是否可以执行this?
您应在尝试挑选某些东西的分支上提交更改。没有活动的更改应该存在,然后您将可以从任何分支中挑选任意数量的提交]
首先,请查看您的git status
,某些文件已更改。比起您可以使用git stash
隐藏隐藏的更改,重置或提交更改。
如果您想将g
和h
的提交合并到m
中,则比这样做
1)
git checkout m
git cherry-pick <commit_from_g>
git cherry-pick <commit_from_h>
git rebase -i #squash last to commits into one
或
2)
git rebase m h
git rebase h g
git checkout g
git rebase -i #squash last to commits into one