Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Devops
  3. Question
Devops

Undoing a git rebase - git undo rebase

Asked by Ben Phillips Apr 20, 2021 1.2K views 1 answer
Share

About this question

Does anybody know how to undo 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

  • 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) then, how to undo git rebase?

 

Any ideas?

Clarification: I'm talking about a rebase during which a bunch of commits was replayed. Not only one.


Your answer

1 Answer

More Devops discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest DevOps Blogs

Guides, tips and career advice on DevOps from JanBask experts.