我有以下问题需要用GIT来解决。
我有以下几点:
+----------+ +----------+
| Branch-0 | --> commit0, commit1, commit2, commit3 --> | Branch-2 | --> commit4
+----------+ +----------+
+----------+
| Branch-1 | --> commit5
+----------+我想将其更改为:
+----------+
| Branch-0 | --> commit0
+----------+
+----------+ +----------+
| Branch-1 | --> commit5, commit1, commit2, commit3 --> | Branch-2 | --> commit4
+----------+ +----------+我想我需要使用git rebase,但不确定。
下面的方法会有效吗?
git checkout Branch-0
git rebase Branch-1
git checkout Branch-1
git rebase Branch-0
git push发布于 2019-10-16 01:02:20
我认为樱桃选择在这里会是一个更好的方法。
对于branch-1,您可以这样做:
git cherry-pick branch0~3..branc0对于brahcn-0,您需要重置
git reset HEAD~3 --hard分支2您可能需要重新创建
git checkout branch-0
git checkout -b branch-2-tmp
git cherry-pick branch-2
git branch -D branch-2
git branch -m branch-2-tmp branch-2https://stackoverflow.com/questions/58399196
复制相似问题