Using Bazaar Patch to merge codes

26 Jun 2013

What is a patch file? This is an important concept.

A patch file is nothing more than a ‘diff’ file. And the ‘merging’ action in version control systems is nothing more than applying the ‘differences’ from the diff file to the current working code copy.

To produce a patch file from current working code copy (you made some changes to the current working copy already) with bazaar, you do it like this:

$ bzr diff > filename.patch

Then, you probably need to merge the patch to ANOTHER working copy of the repository later on (and you don’t want to manually type in all the changes you made again). What do you do?

One way to do it is with ‘bzr patch’, see below:

# run this command within the working directory of 
# the "ANOTHER working code copy"
$ bzr patch filename.patch

But this raises a question, shouldn’t bzr merge work the same as bzr patch?

I will find that out later …