简体   繁体   中英

Extract a particular version file from Git repository

Is it possible to pull out a specific version of a file from a Git repository to an external folder location?

I have a few excel (binary) files in y Git repo. I want to pull out specific version of that file to an external folder without having to do a git checkout , so that my current working directory is not disturbed.

System information:
Windows 8, 64 bit.
msysgit 1.9.4

There is an useful tool on git. It can be use by show command. See all of the options of show by giving command -

git show

If you want to see the particular version of a file just use the following format -

git show commit:filename

Now export to a file by --

git show commit:filename > newfilename

git show <commit>:<path> will print out file in given path from given commit. Just store it into a file using > and you're done.

I don't know if it'll work for binary files. You can use the git show command. The usage will be:

git show commitHash:path/to/file.xls

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM