tags:

views:

42

answers:

1

I have to check out my source code from two days ago. Whenever I have to do this, I have to look up the syntax. It's not in the git-checkout page. I'd like to have a convenient Stack Overflow question to refer to so I don't have to look it up every time. If this has already been asked, please point me to the dupe. :)

How do I check out my source code in git from two (or N) days ago?

+5  A: 
git checkout @{two.days.ago}
Robie Basak
For completeness: this fuzzy date stuff is internally called "approxidate". It'll actually accept any non-alphanumeric character where you've used the dots, to save you having to quote spaces. Dots are probably the most convenient (not to mention readable), though, since `;` `'` and `,` are special characters in bash.
Jefromi
Note that this command would checkout what you had checked out in **your** repository two days ago; it is local repository only information. See "Specifying revisions" section in [`git rev-parse`](http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html) documentation; it uses *reflog*
Jakub Narębski