- Published
- Author
- Sudeep Hipparge
How to Revoke (Undo) a Git Rebase
If you’ve run a
1.Check your reflog to find the commit before rebase started:
Look for the commit hash just before the rebase (usually marked with
2.Reset your branch back to that commit:
This will reset your branch to the exact state before the rebase.
Important:
• Use
#Git
If you’ve run a
git rebase and need to undo it due to issues, here’s a simple way to revert back:1.Check your reflog to find the commit before rebase started:
Code
git reflogLook for the commit hash just before the rebase (usually marked with
rebase started).2.Reset your branch back to that commit:
Code
git reset --hard <commit-hash>This will reset your branch to the exact state before the rebase.
Important:
• Use
git reset --hard with caution, as it will discard any uncommitted changes.#Git