Modern QA2026Resolving Conflicts During Rebase — tiles
Log inJoin
13 / 57 · 17 Git & Version Control · Rebase vs Merge← prev⊞ allnext →☰ Read as one page

2.5Resolving Conflicts During Rebase

When rebasing, Git replays each commit one by one. If a commit conflicts with the target branch, Git pauses and asks you to resolve it.

git rebase main
# CONFLICT (content): Merge conflict in tests/login.spec.ts
# Fix stopped at abc123f... Add login retry test

# Step 1: Open the conflicting file and resolve the conflict markers
# <<<<<<< HEAD
# current main version
# =======
# your version from the feature branch
# >>>>>>> Add login retry test

# Step 2: After resolving, stage the file
git add tests/login.spec.ts

# Step 3: Continue the rebase
git rebase --continue

# If you want to abort and go back to the state before rebase:
git rebase --abort

Tips for conflict resolution:

  • Read both versions carefully. Do not blindly accept one side.
  • If the conflict is in test code, check whether both sides added tests for the same feature. You may need to keep both.
  • Use git rebase --abort if you are unsure. You can always try again.
  • After resolving, run the tests locally to make sure the resolution is correct.