I would like to do this:
git --git-dir=../navcl/.git format-patch -k -1 --stdout 607780ee9 \
| nano \
| git am -3 -k
The issue is, in my other git dir, a file path is different, so I need to edit this in the patch. I could go via a file, but is there the option to edit the piping command in an editor? My use of nano
here doesn't actually work, since I'm not aware how to get it to write to stdout.
sed
. – jesse_b Oct 25 '19 at 13:32sed
replacement, of course. (It would be error-prone, though, because even if I edit the path I need to adapt, I cannot generally be sure that this path does not appear as part of the patch contents, where it might not need to be changed.) – Felix Dombek Oct 25 '19 at 13:34sed
is turing complete, pretty much anything that is possible is possible insed
. Since so far everything about your task seems to be describing the standard use ofsed
, I'm sure it will be a relatively easy command to come up with. – jesse_b Oct 25 '19 at 14:03vipe
is a great suggestion, thanks for sharing the link. – Felix Dombek Oct 25 '19 at 14:05pipevi(){ t=$(mktemp) && cat >"$t" && vi "$t" </dev/tty >/dev/tty 2>&1 && cat "$t" && rm "$t"; }
. – Oct 25 '19 at 14:12