Interview Prep/Git & GitHub/Undoing changes: reset, revert, restore and reflog

How does `git revert` handle a commit that has already been partially undone or conflicts?

AdvancedConceptUndoing changes: reset, revert, restore and reflog
Answer

Revert is a three-way merge using the commit as the base and its parent as the "theirs" side. If later commits changed the same lines you get a conflict to resolve normally, then git revert --continue. -n applies the inverse without committing so several reverts can be combined into one commit.

git revert -n abc123 def456
git commit -m "revert: roll back checkout redesign"
All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing changes: reset, revert, restore and reflog