How to create patch file?

  • Alexey Grachov
    Alexey Grachov

    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

      (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

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