Thursday, March 29, 2012

Always Pull Branches When Merging

A question came up at work today that I've had to stop and remind myself numerous times and I'm sure other people have to think about on occasion. When merging changes from a branch back to an origin, should I pull them from branch into origin or push them from branch to origin. The difference in CVS would be... do I check out the origin and merge the deltas of the branch into working copy or check out the branch and somehow push those changes onto the trunk.

In short, always pull changes into a clean local copy that represents where the destination of the merge should be. It really doesn't matter which Revision Control System you use, this will almost always be the safest way to merge (assuming it supports a local copy).

I say this for one very important reason, you MUST be able to resolve conflicts before committing changes to the central repository, pushing doesn't necessarily allow you to do that unless the tools supports something like Multi Version Concurrency Control on a single revision (*and I'm not aware of any systems that do this right now).

No comments: