撤消git rebase - Undoing a git rebase

问题:

Does anybody know how to easily undo a git rebase? 有人知道如何轻松撤消git rebase吗? git

The only way that comes to mind is to go at it manually: 想到的惟一方法是手动进行操做: app

  • 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). 在我目前的状况下,这是可行的,由于我能够轻松地发现两个分支的提交(一个是个人东西,另外一个是我同事的东西)。 ide

However my approach strikes me as suboptimal and error-prone (let's say I had just rebased with 2 of my own branches). 可是,个人方法给个人印象是次优且容易出错(例如,我刚刚使用本身的两个分支进行了从新基准化)。 this

Any ideas? 有任何想法吗? idea

Clarification: I'm talking about a rebase during which a bunch of commits were replayed. 澄清:我说的是一个重定基础,在此基础上重播了不少提交。 Not only one. 不仅是一个 spa


解决方案:

参考一: https://stackoom.com/question/Z5W/撤消git-rebase
参考二: https://oldbug.net/q/Z5W/Undoing-a-git-rebase
相关文章
相关标签/搜索