Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

How to create patch file?

Help
2008-05-23
2013-04-02
  • Alexey Grachov
    Alexey Grachov
    2008-05-23

    I am doing the following:
    # diff file(new) file(old) > file.patch
    Is this correct?
    Is it possible to make one patch for several files?

     
    • Robert Pearce
      Robert Pearce
      2008-07-28

      (This really isn't anything to do with GPSim, but I'll answer anyway)

      You need to give diff some option arguments to get a meaningful patch format. From memory I think the -c option (or -Cx where x is the number of lines) gives the right "context" format, or -u for the "unified" format. You also need to ensure the files are in the right order, namely old then new.

      If you want to create a patch from multiple files, the do a diff of the directory structures. For that you will need the -r (recurse) option, and probably -N to treat "new" files as if the missing one were just empty.

      You may want to look at http://www.cpqlinux.com/patch.html

      Or you could have typed "patch file using diff" into google, like I did.