Pulling out a copy of repo up to a particular commit?
Is there a way to pull out a copy of my repo up to a certain commit? I'm using github, and I see a particular checkin has the following ids on its page:
commit: ab开发者_JAVA技巧c
tree: def
parent: xyz
So I'd like to do something like:
git clone -option-up-to-commit "abc"
So I can get a snapshot of my project at that point in time?
Thanks
If it doesn't matter that you clone the whole repo first, just do
$ git clone repo
$ cd repo
$ git checkout commit-hash
Clone implies you are going to get the entire history. Simply checking out the sha1 that you want will do the trick. If later commits have large files in them and you don't want those, you can clone, branch at the commit you want, remove the tracking branches for the remote and clone again. This will omit the commits you don't want in your history.
Hope this helps.
精彩评论