I'm developing a Rails app and using git. I decided to tryout a new gem, and created a git commit prior to any changes. To implement the gem involved removing some of my own code.
When I added the gem and made some other changes, I realised it would have been nice to have the earlier version of the app running, so I could compare side-by-side.
I solved the issue by rolling back git, copying the file tree and then re-applying the changes related to the new gem. That is I did the following:
$ git reset --hard HEAD
$ git clean -f -d
Is it possible to create a clone of a (local) git repository from one of the historical savepoints?
Assuming "historical savepoints" are equivalent to commit times, as file-specific timestamps are not recorded by default, the checkout command's syntax appears to be:
git checkout branch@{timediff}
As in git checkout master@{1 day ago}, alternatively, you can use git log to isolate your commit ID and check it out with git checkout master commitId.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With