Created
March 8, 2016 13:23
-
-
Save antillean/d2237538b76ff247abcf to your computer and use it in GitHub Desktop.
Git: get version of file at date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## The following checks out a file as it was on the current branch NUM_DAYS days ago. | |
## See manual page on gitlog for more date info: https://git-scm.com/docs/git-log | |
## (That includes info on the other ways of specifiying a date.) | |
git checkout `git log -n1 --before="${NUM_DAYS} days ago" --format="%H" path/to/file` path/to/file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment