[英]how to export all branch changed files compared to local master from git
I am using the following to export all the changed files from my master branch: 我正在使用以下内容从我的master分支导出所有更改的文件:
git archive --output=test_v2.zip HEAD $(git diff --name-only master)
however it gives me the following error: 但是它给我以下错误:
error: unknown option `name-only'
usage: git archive [<options>] <tree-ish> [<path>...]
or: git archive --list
or: git archive --remote <repo> [--exec <cmd>] [<options>] <tree-ish> [<path>...]
or: git archive --remote <repo> [--exec <cmd>] --list
--format <fmt> archive format
--prefix <prefix> prepend prefix to each pathname in the archive
-o, --output <file> write the archive to this file
--worktree-attributes
read .gitattributes in working directory
-v, --verbose report archived files on stderr
-0 store only
-1 compress faster
-9 compress better
-l, --list list supported archive formats
--remote <repo> retrieve the archive from remote repository <repo>
--exec <command> path to the remote git-upload-archive command
what am I doing wrong? 我究竟做错了什么?
it creates test_v2.zip but it is empty. 它创建了test_v2.zip,但为空。
based on my research I think I should not use $ sign but I don't know what to use then. 根据我的研究,我认为我不应该使用$符号,但是我不知道该使用什么。
Your example works fine in bash
. 您的示例在
bash
运行良好。 But you try to run it in cmd.exe
. 但是您尝试在
cmd.exe
运行它。 The $()
syntax is Bash syntax to start a subshell, execute the enclosed command and replace the construct with the output. $()
语法是Bash语法,用于启动子shell,执行附带的命令并将结构替换为输出。
Either do the same in Git Bash (anyway the better choice) or use a cmd.exe
specific construct instead if one exists. 在Git Bash中进行相同的操作(无论如何都是更好的选择),或者使用
cmd.exe
特定的构造代替(如果存在)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.