Git: checkout by date
Submitted by Bram Schoenmakers on 27 July, 2009 - 10:05.
Tagged: git
Sometimes it's handy to checkout a branch based on a point in time.
git checkout master@{2009-07-27 13:37}
will not work, because it uses the reflog (which expires after some time).
The trick (as found on Nabble) is to lookup the revision on a certain date and check out that revision. This can be done in a single command:
git checkout `git rev-list -n 1 --before="2009-07-27 13:37" master`