Why won't this command work ?
git diff | git --git-dir=/other/location/.git --work-tree=/other/location apply
The following works perfectly:
git diff > /tmp/my.patch
cd /other/location && git apply /tmp/my.patch
/other/location
is a mirror of the current directory.
With the piped command I get
error: patch failed: myfile.php:1
error: myfile.php: patch does not apply
This works for me (git 2.6.3
):
git diff | git -C /other/location apply
From 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>.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With