Ala*_*air 6 git shell patch zsh
为什么这个命令不起作用?
git diff | git --git-dir=/other/location/.git --work-tree=/other/location apply
Run Code Online (Sandbox Code Playgroud)
以下工作完美:
git diff > /tmp/my.patch
cd /other/location && git apply /tmp/my.patch
Run Code Online (Sandbox Code Playgroud)
/other/location 是当前目录的镜像.
通过管道命令,我得到了
error: patch failed: myfile.php:1
error: myfile.php: patch does not apply
Run Code Online (Sandbox Code Playgroud)
Ale*_*ein 11
这适用于我(git 2.6.3):
git diff | git -C /other/location apply
Run Code Online (Sandbox Code Playgroud)
来自man git:
-C <path>
Run as if git was started in <path> instead of the current working
directory. When multiple -C options are given, each subsequent
non-absolute -C <path> is interpreted relative to
the preceding -C <path>.
Run Code Online (Sandbox Code Playgroud)