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

What does `git reset <commit> -- <path>` do, and how does it differ from `git restore --source`?

IntermediateConceptUndoing changes: reset, revert, restore and reflog
Answer

git reset &lt;commit> -- path copies the file's version at &lt;commit> into the index only, leaving the working tree alone. git restore --source=&lt;commit> path writes into the working tree (and with --staged also the index). Neither moves the branch pointer.

All Git & GitHub questions Roadmap: Git & GitHub

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