繁体   English   中英

如何从git导出所有分支更改的文件与本地主文件相比

[英]how to export all branch changed files compared to local master from git

我正在使用以下内容从我的master分支导出所有更改的文件:

git archive --output=test_v2.zip HEAD $(git diff --name-only master)

但是它给我以下错误:

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

我究竟做错了什么?

它创建了test_v2.zip,但为空。

根据我的研究,我认为我不应该使用$符号,但是我不知道该使用什么。 在此处输入图片说明

您的示例在bash运行良好。 但是您尝试在cmd.exe运行它。 $()语法是Bash语法,用于启动子shell,执行附带的命令并将结构替换为输出。

在Git Bash中进行相同的操作(无论如何都是更好的选择),或者使用cmd.exe特定的构造代替(如果存在)。

暂无
暂无

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

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