问题:
Does anybody know how to easily undo a git rebase? 有人知道如何轻松撤消git rebase吗?
The only way that comes to mind is to go at it manually: 想到的唯一方法是手动进行操作:
- git checkout the commit parent to both of the branches git签出两个分支的提交父对象
- then create a temp branch from there 然后从那里创建一个临时分支
- cherry-pick all commits by hand 手动选择所有提交
- replace the branch in which I rebased by the manually-created branch 用手动创建的分支替换我重新建立基础的分支
In my current situation this is gonna work because I can easily spot commits from both branches (one was my stuff, the other was my colleague's stuff). 在我目前的情况下,这是可行的,因为我可以轻松地发现两个分支的提交(一个是我的东西,另一个是我同事的东西)。
However my approach strikes me as suboptimal and error-prone (let's say I had just rebased with 2 of my own branches). 但是,我的方法给我的印象是次优且容易出错(例如,我刚刚使用自己的两个分支进行了重新基准化)。
Any ideas? 有任何想法吗?
Clarification: I'm talking about a rebase during which a bunch of commits were replayed. 澄清:我说的是一个重定基础,在此基础上重播了很多提交。 Not only one. 不只是一个
解决方案:
参考一: https://stackoom.com/question/Z5W/撤消git-rebase参考二: https://oldbug.net/q/Z5W/Undoing-a-git-rebase
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4295924