Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fullstackto/9271830 to your computer and use it in GitHub Desktop.
Save fullstackto/9271830 to your computer and use it in GitHub Desktop.
How to grab a file from a previous git commit
git checkout HEAD~n path/to/file.ext
git commit -am "Retrieving file_name.ext from previous commit"
git push origin
Where n in HEAD~n is the number of previous commits to go back for the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment