All fixes

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.

What Git says~/my-app
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

  1. Fix the conflicted files. Careful: in a rebase, the HEAD side is the branch you are rebasing onto, and your commit is the other one.

  2. git add index.html

    Marks the file as resolved.

  3. git rebase --continue

    Carries 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.

What happens to your history
BeforeABDCorigin/mainHEADfeature/login
AfterABDC′origin/mainHEADfeature/login

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.