答案 0 :(得分:2)
首先,转到branchA
和cherry-pick
这两个要提交的提交。
$ git checkout branchA
$ git cherry-pick <commit1> # commit1 = 0a18e0f
$ git cherry-pick <commit2> # commit2 = e604ce4
$ git push origin HEAD # push to remote
现在从branchB
或revert
移除rebase
的两次提交。 Revert是首选,因为它不会改变git历史记录。
<强>恢复强>
$ git checkout branchB
$ git revert <commit1>
$ git revert <commit2>
$ git push origin HEAD
<强>调整基线:强>
$ git checkout branchB
$ git rebase -i efb2443 # go back to the commit before the two commmits you want to remove
Now comment out (adding `#` before the commit hash) the two commits you want to remove.
$ git push -f origin HEAD # you need to force(-f) push as history is changed here by rebasing