[英]Pipe git diff to git apply
為什么這個命令不起作用?
git diff | git --git-dir=/other/location/.git --work-tree=/other/location apply
以下工作完美:
git diff > /tmp/my.patch
cd /other/location && git apply /tmp/my.patch
/other/location
是當前目錄的鏡像。
通過管道命令,我得到了
error: patch failed: myfile.php:1
error: myfile.php: patch does not apply
這對我git 2.6.3
( git 2.6.3
):
git diff | git -C /other/location apply
來自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>.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.