Reputation: 4534
I'm sure this can be done (?) (in clearcase it would be quite simple).
Upvotes: 15
Views: 18477
Reputation: 12594
first, you have to get the string that identify the commit:
git rev-list -n 1 --before="2009-07-27 13:37" origin/master
it prints the string (for instance XXXX), copy it and do this command:
git checkout XXXX
Upvotes: 3
Reputation: 133822
Use git log
to determine a suitable revision to switch to, e.g.:
git log --since='2010-04-01' --until='2010-04-02'
This will show all the commits on 2010-04-01, so just pick the one that corresponds to the instant you want the files for, and note its commit id. Then just use git checkout COMMIT-ID
to switch the workspace to that commit. This will detach your workspace (HEAD) from the current branch, use git checkout master
to return.
Upvotes: 15
Reputation: 1329860
Don't forget file timestamp are not recorded in a DVCS like Git.
Only commit timestamp are there, and you can checkout easily a commit from a certain date.
git checkout master@{1 month 2 weeks 3 days 1 hour 1 second ago}
(Note: such a checkout would give you a detached HEAD)
In ClearCase, this is easy provided you set the "preserve file time" option to true.
(if not, you actually record the checkin time of each file, which is a bit like the Git commit timestamp, except for every files)
Upvotes: 7