Help, I am stuck in a rebase with conflicts
A rebase stopped halfway because of a conflict. Finish it, or go back to how things were.
git rebase origin/main Auto-merging index.html CONFLICT (content): Merge conflict in index.html error: could not apply 94ec8cd... Login title hint: Resolve all conflicts manually, mark them as resolved with hint: "git add/rm <conflicted_files>", then run "git rebase --continue". hint: You can instead skip this commit: run "git rebase --skip". hint: To abort and get back to the state before "git rebase", run "git rebase --abort". Could not apply 94ec8cd... Login title
The fix
Fix the conflicted files. Careful: in a rebase, the
HEADside is the branch you are rebasing onto, and your commit is the other one.git add index.htmlMarks the file as resolved.
git rebase --continueCarries on with the remaining commits. If the editor opens for the message, save and close. Repeat for every commit that conflicts.
index.html is an example. Replace it with your own.
git rebase --abortYour branch goes back to exactly where it was before the rebase.
Why this works
A rebase replays your commits one at a time on top of another branch, and it pauses at each one that conflicts. That is why you may have to resolve, add and continue more than once. Watch out: during a rebase the sides are swapped compared to a merge. HEAD is the branch you are rebasing onto, and your own change is the other side. git rebase --abort is always available until the last commit is through.