Wednesday, July 8, 2009

Applying git patches

I had some problems applying my patches - the patch complained about files not being found. I tried using git apply and "patch -p0"
I also tried the "patch -p2" because I noticed the "a/" and "b/" prefixes to the names of folders.
What should be done when applying patches created by git diff, you should use
patch -p1
This command should be run from the e.g. build/ooo310-m14 folder
This was one option I didn't try, thinking p1 would cut the "a" and then navigate to my root folder. Strangely, the -p1 option is the way to go :)

This removes the dummy "a/" and "b/" names of folders.

Hope this saves someone a few hours of manually editing the files :)

1 comments:

cedric said...

Hi Maja,

You can also use the --no-prefix option when creating the git diff: this will remove the a/ b/ prefixes folders from the diff, and then the -p0 option can be used.

Post a Comment