What this error means
Git reports "fatal: rebase in progress" when a previous rebase has not finished and you try to start another operation that conflicts with it (e.g., pull, merge, or another rebase). You must either continue or abort the in-progress rebase.
Typical causes:
- You started a rebase and hit a conflict but didn't resolve it.
- A previous rebase was interrupted (crash, editor closed, CI canceled).
- A script attempted another operation while a rebase was active.
Quickstart (most cases)
- Check status:
git status(it will say "You are currently rebasing"). - Decide:
- Continue the rebase after resolving conflicts:
git rebase --continue. - Abort and return to the original branch state:
git rebase --abort. - Stop tracking the rebase but keep current worktree changes:
git rebase --quit.
- Continue the rebase after resolving conflicts:
- If conflicts exist:
- Fix files,
git add <files>, thengit rebase --continue.
- Fix files,
- If the rebase seems stuck or corrupt:
- Try
git rebase --abortorgit rebase --quit. - As a last resort, back up and remove
.git/rebase-mergeor.git/rebase-applyafter verifying withgit status.
- Try
Minimal working example (reproduce and fix)
# Start a demo repo
mkdir demo-rebase && cd demo-rebase
git init
git branch -M main
echo "line" > file.txt
git add file.txt
git commit -m "init"
# Create a feature branch and change the same line
git checkout -b feature
echo "feature change" > file.txt
git commit -am "feature edit"
# Diverge main with a conflicting change
git checkout main
echo "main change" > file.txt
git commit -am "main edit"
# Start a rebase that will conflict
git checkout feature
git rebase main
# Resolve conflict now OR simulate the fatal message by attempting another op:
# (this triggers: fatal: rebase in progress)
# git merge main
# Proper fix: resolve and continue
# Edit file.txt to the desired content
printf "resolved content\n" > file.txt
git add file.txt
git rebase --continue
# Verify history is linear and clean
git log --oneline --graph --decorate --all
Step-by-step resolution guide
Detect rebase state
- Run:
git status - Look for: "rebase in progress; onto <commit>" or "You are currently rebasing".
- Internal markers:
.git/rebase-merge/or.git/rebase-apply/exist.
- Run:
Choose an outcome
- Keep the rebase: resolve conflicts, then
git rebase --continue. - Cancel the rebase and restore pre-rebase state:
git rebase --abort. - Exit rebase bookkeeping but keep current changes:
git rebase --quit.
- Keep the rebase: resolve conflicts, then
Resolve conflicts (if any)
- Open conflicted files, choose the correct content.
- Mark resolved:
git add <files>. - Continue:
git rebase --continue. - If the next commit also conflicts, repeat until done.
Verify and push
- Inspect:
git log --oneline --graph - If you rebased commits that are already pushed, you will need
git push --force-with-leaseto update the remote safely.
- Inspect:
Common situations and commands
| Situation | Command |
|---|---|
| Continue after fixing conflicts | git rebase --continue |
| Abort and restore original state | git rebase --abort |
| Stop rebase bookkeeping, keep changes | git rebase --quit |
| Skip the current patch | git rebase --skip |
| Edit remaining rebase plan | git rebase --edit-todo |
Recovering from a stuck or stale rebase
If your repo was interrupted (power loss, CI cancellation) and Git complains about an in-progress rebase:
Try the safe exits first:
git rebase --abort(preferred)git rebase --quit(if you want to keep current worktree changes)
If those fail, inspect state:
test -d .git/rebase-merge && echo merge-modeortest -d .git/rebase-apply && echo apply-modegit statusto see which files are staged or conflicted
Manual cleanup (last resort):
- Back up your branch:
git branch backup/<name> - Remove the rebase dir:
rm -rf .git/rebase-merge .git/rebase-apply - Optionally restore to pre-rebase commit:
git reset --hard ORIG_HEAD(destructive; ensure backup)
- Back up your branch:
Use reflog for recovery:
git reflogshows recent HEAD positionsgit reset --hard <reflog-id>to return to a known-good state
DevOps-focused practices
- Pre-merge checks: Require clean working trees and no ongoing rebase in CI before running release jobs.
- Safer updates: Use
git pull --rebase --autostashin automation to avoid merge commits and reduce conflicts. - Protect shared history: When rebasing commits that have been pushed, coordinate and use
--force-with-leasein CI to avoid overwriting teammates' work. - Re-run conflict resolutions faster:
git config rerere.enabled trueto have Git remember conflict resolutions across rebases.
Performance notes
- Rebasing large stacks is O(number of commits). Limit scope with:
git rebase --rebase-mergesto preserve structure when necessary (can reduce conflict churn).git rebase -i --autosquashto squash fixups and reduce the number of applied commits.
- Avoid repeatedly rebasing long-lived branches against fast-moving main; rebase just before integration.
- Use shallow clones in CI only if you do not need to rewrite deep history.
Pitfalls and how to avoid them
- Force pushing after rebase without
--force-with-leasecan clobber teammates’ changes. Always prefer--force-with-lease. - Manually deleting rebase state without a backup can lose work. Create a safety branch first.
- Mixing merge and rebase on the same branch can create confusing histories. Pick a strategy per branch.
- Running new Git operations during a rebase triggers the fatal error. Finish or abort the rebase first.
Tiny FAQ
- Q: Should I use
--abortor--quit?- A:
--abortrestores the pre-rebase commit;--quitstops the rebase bookkeeping but keeps current index/worktree.
- A:
- Q: Will aborting delete my uncommitted changes?
- A: It restores the branch tip; local changes may be preserved or conflicted. Stash first if unsure:
git stash -u.
- A: It restores the branch tip; local changes may be preserved or conflicted. Stash first if unsure:
- Q: How do I know what commit I started from?
- A:
ORIG_HEADpoints to it. Seegit log -1 ORIG_HEADorgit reflog.
- A:
- Q: Can I fix the error by pulling?
- A: No. Complete or abort the rebase first; then
git pull --rebaseif desired.
- A: No. Complete or abort the rebase first; then