Git Tip: git checkout
allows you to restore a single file to a previous version without affecting the rest of your project. For example: git checkout--
.
Full example below:
# View the commit history of a specific file.
git log -- path/to/file
# Restore a specific file to its state from a previous commit.
git checkout -- path/to/file
# Restore a specific file from a different branch.
git checkout -- path/to/file
# Restore a specific file to its state from 1 day ago.
git checkout HEAD@{1.day.ago} -- path/to/file