Advertisement
thioshp

Patching Files

Feb 6th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Contacts: Diff & Patch
  2.  
  3. SEE Diff&Patch: How To
  4.  
  5. cd BACKUPS/Contacts/
  6.  
  7. mkdir patches
  8.  
  9. cp gmail-contacts-00001.vcf GmailContacts.vcf ./patches/
  10.  
  11. cd patches/
  12.  
  13. 1. Clearly mark OLD and NEW files:
  14. rename files to *-old and *-new
  15. $ mv gmail-contacts-00001.vcf gmail-contacts-old.vcf && mv GmailContacts.vcf gmail-contacts-new.vcf
  16.  
  17. 2. Compare files:
  18. create the patch file using diff command
  19. $ diff -u gmail-contacts-old.vcf gmail-contacts-new.vcf >gmail-contacts.patch
  20.  
  21. 3. Validate the Patch without Applying (Dry-run Patch File):
  22.  
  23. You can dry run the patch command to see if you are getting any errors, without patching the file using –dry-run option.
  24. $ patch --dry-run < gmail-contacts.patch
  25.  
  26. 3. Update OLD file:
  27. create backup file of gmail-contacts-old.vcf before patching i.e. creates gmail-contacts-old.vcf.orig before applying patch to the older filer
  28. $ patch -b < gmail-contacts.patch
  29.  
  30. You can also use -V to decide the backup filename format as shown below. Now you will have a file name “gmail-contacts-old.vcf.~1~”.
  31. $ patch -b -V numbered > gmail-contacts.patch
  32.  
  33. 4. Reverse a Patch that is Already Applied (Undo a Patch)
  34.  
  35. You can use the -R option to reverse a patch which is applied already:
  36. $ patch -R < gmail-contacts.patch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement