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"
More on Undoing changes: reset, revert, restore and reflog
What are the three modes of `git reset`?BeginnerWhat is the difference between `git reset` and `git revert`?BeginnerHow do you discard changes in one file?BeginnerHow do you recover a commit after `git reset --hard`?IntermediateCan you recover uncommitted changes lost by `git reset --hard` or `git checkout .`?IntermediateWhat does `git commit --amend` do to the reflog and to the old commit?Intermediate