tags:

views:

169

answers:

2

I'm guessing it allows you to "save" a merge process so I could create a patch for some Open Source project, and submit a patch so they don't have to handle the merge themselves?

When and how would you use patches in SVN?

+11  A: 

patches (unified diff files in svn) are used for various situations:

  1. You don't have commit access, but you have some modifications to a project which you want to get included. In that case, you create a patch from your modifications and send the patch file to the ones who have commit access. Of course that doesn't mean that they will commit your patch, but it makes it easier for them to do so.
  2. You have modifications which you don't want to commit yet. You then send the patchfiles to others so they can review your modifications and comment on them.

There are other situations where patchfiles are useful, but those are most very specific to projects.

Without using patchfiles, you'd have to send all your modified files in whole, which usually results in a much bigger (zip) file.

And of course, it's possible to apply a patchfile to a working copy which already has its own modifications - if you would send whole files those local modifications would get overwritten.

Stefan
For your second scenario: that's what branches are for ;) Solid post though. +1
sirlancelot
That depends: for a change that's only two/three lines and should fix a bug I don't create a branch. I then create a patch and send it for review if I'm not sure whether that change might affect something else I maybe haven't thought of.
Stefan
Hi Stefan, we love your work -- we use Tortoise every day to work on SO! :)
Jeff Atwood
+1  A: 

Patches are used by people who don't have direct access for SVN repository. They send it to one of SVN users and he/she may or may not merge it to SVN repository.

raspi