簡體   English   中英

管git diff到git應用

[英]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.3git 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM