git checkout is used to update files in the current working tree to a specific version in the index or specified branch.

To restore a file to the version in the index:

git checkout -- <filename>

Popular questions

See also

  • git
  • git-reset
  • git-revert

References

$ git checkout --help