简体   繁体   English

git:提取特定文件时选择分支

[英]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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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