Ayusman
Ayusman

Reputation: 8719

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

Upvotes: 3

Views: 484

Answers (3)

Robel Sharma
Robel Sharma

Reputation: 972

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

Upvotes: 4

hjpotter92
hjpotter92

Reputation: 80639

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

Upvotes: 1

che
che

Reputation: 12263

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.

Upvotes: 2

Related Questions