简体   繁体   中英

git: Select branch when fetching specific file

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

git archive --remote=git@my.git.server: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?

经过一番尝试和错误之后,事实证明这是解决问题的方法,例如有人要从develop分支获取以上文件:

git archive --remote=git@my.git.server:namespace/projectname.git develop:path/to/file somefile.sql | tar -x

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