Say I have a diff file looking basically like the following.
+line a
-line b
Is it possible to do one (or both) of the following:
Inverse this file (so I'd get)
-line a
+line b
Pass some argument to patch
so the end result the same as applying
the inversed diff file described above
Here is what you should do (assuming newFile.txt is the file you want to apply the reversed diff file on and diffFile.txt is the diff file):
patch -R newFile.txt diffFile.txt -o oldFile.txt
To rewrite a reversed / inverted diff file, use interdiff
from diffutils:
interdiff -q my-diff-file /dev/null
You can leave the diff as is and apply in reverse
git apply --reverse backwards-diff
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