git reset vs revert vs restore

I forgot the git command to restore a single file to a specific commit, modifying the working directory. It’s git restore. But I need to remember the difference between git restore, git reset, and git revert….

The Github Documentation Page

The github /git documentation page says this:

  • git-revert is about making a new commit that reverts the changes made by other commits.
  • git-restore is about restoring files in the working tree from either the index or another commit. This command does not update your branch. The command can also be used to restore files in the index from another commit.
  • git-reset is about updating your branch, moving the tip in order to add or remove commits from the branch. This operation changes the commit history.

Nate should revisit this post to clarify:

checkout vs restore

Some confusion about checkout vs restore. Seems like restore and switch are subsets of checkout functionality.

Other helpful links