git: Select branch when fetching specific file

56 views Asked by At

It is possible to define a specific branch when fetching a file as follows:

git archive [email protected]:namespace/projectname.git HEAD:path/to/file somefile.sql | tar -x

This will retrive the file from the default project branch.

How is it possible to select a specific branch for the above file retrieval?

1

There are 1 answers

0
pkaramol On BEST ANSWER

After some trial and error, turns out this is the way to go about it, when say someone want to get the above file from develop branch:

git archive [email protected]:namespace/projectname.git develop:path/to/file somefile.sql | tar -x