[英]GIT : How to get latest changes from master branch to the custom branch using git commands?
[英]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.