Recreating a file from diff
How do I create a source file from diff, I have one of the files and the other is unknowingly. Is there any tool to convert the diff output to 'ed' diff format (diff -e output) or pattern output format?
+3
user1730177
source
to share
3 answers
If you have:
- old file and
- diff
then it's just a matter of applying diff in the usual way:
patch the_file <the_diff
This is a common use case for diff.
If you have:
- new file and
- diff
then you can simply apply the patch in reverse order with the option patch
-R
:
patch -R the_file <the_diff
+2
Celada
source
to share
This is exactly what it is patch
for!
+1
William pursell
source
to share
Yes, use patch
to apply diff to one of the source files.
+1
Oliver Charlesworth
source
to share