Git & GitHub Interview Question #47

How do you continue or abort a rebase after conflicts?

Remotes, Fetch, Pull, Push, Merge, Conflicts, Rebase & Stash Mid-Level Intermediate

Quick Interview Answer

When a rebase stops because of a conflict, resolve the affected files and stage the resolutions. Then run git rebase --continue so Git can continue replaying commits.

Detailed Explanation

When a rebase stops because of a conflict, resolve the affected files and stage the resolutions. Then run git rebase --continue so Git can continue replaying commits.

If the rebase should not proceed, git rebase --abort attempts to return the branch to its state before the rebase began. git status is useful throughout the process.

Code Example

git status

# Resolve files, then:
git add resolved-file.cs
git rebase --continue

# Or cancel the rebase:
git rebase --abort