Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are patches used for in SVN?

Tags:

svn

patch

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?

like image 676
KingNestor Avatar asked Feb 28 '09 08:02

KingNestor


People also ask

What is a patch in svn?

A patch is a file that show the differences between two revisions or between your local repository and the last revision your repository is pointing. To share or save a patch of your local uncommitted changes either for peer review or to apply later, do: svn diff > new-feature.patch.

What does apply patch mean?

The apply patch is used to add changes saved into a diff file (that is the patch) to the current file/project. Such patches are used e.g. for summarizing changes that can be moved independently of version control systems, such as added as a Bugzilla attachment.

How does patch file work?

What is patch? patch is a command that takes the output from the diff and puts it into a file. Then, it can take the filed output and overwrite another file with with the changes. For example, a common use is to use the patch to transfer changes from the changed file to the original file, thus making them identical.


1 Answers

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.

like image 92
Stefan Avatar answered Sep 20 '22 06:09

Stefan