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 <commit> -- path copies the file's version at <commit> into the index only, leaving the working tree alone. git restore --source=<commit> path writes into the working tree (and with --staged also the index). Neither moves the branch pointer.
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