diff/patch

OMG that seemed to be overly difficult. All I wanted to do was create a patch of a duplicate local folder and apply it locally to the folder in the svn repository. I kept getting the problem that patch only wanted to apply the patchfile in the wrong directory.

After a long time in #svn the answer was to use relative diff and patch commands.

  1. cd into the directory that contains the 2 directories you’re messing with. In my case this was altering themes in Squib. So starting in squib/trunk the command was

    cd ./themes

  2. Run the diff on relative paths. In this case folder1 has the changes and folder2 contains the files to be changed.

    diff -r -u -x "\.*" folder2 folder1 > patchfile

  3. cd ./folder2

  4. Apply the patch.

    patch -p1 < ../patchfile

For some reason beyond my explanation when I was using absolute paths the patch kept wanting to be applied in reverse. Curious.

Related posts:

  1. Autodiscovery patch completed It’s always nice to have a sense of accomplishment. I’ve...
  2. New Themes OK, for the curious look at “Change Style” section of...
  3. Theme Stylesheets I’ve made some Squib modifications that allows for selection of...

Related posts brought to you by Yet Another Related Posts Plugin.

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.