Best practices to deal with "slightly different" branches of source code

Posted by jedi_coder on Stack Overflow See other posts from Stack Overflow or by jedi_coder
Published on 2010-06-11T19:25:44Z Indexed on 2010/06/11 19:32 UTC
Read the original article Hit count: 153

Filed under:

This question is rather agnostic than related to a certain version control program.

Assume there is a source code tree under certain distributed version control. Let's call it A.

At some point somebody else clones it and gets its own copy. Let's call it B.

I'll call A and B branches, even if some version control tools have different definitions for branches (some might call A and B repositories).

Let's assume that branch A is the "main" branch. In the context of distributed version control this only means that branch A is modified much more actively and the owner of branch B periodically syncs (pulls) new updates from branch A.

Let's consider that a certain source file in branch B contains a class (again, it's also language agnostic). The owner of branch B considers that some class methods are more appropriate and groups them together by moving them inside the class body. Functionally nothing has changed - this is a very trivial refactoring of the code. But the change gets reflected in diffs. Now, assuming that this change from branch B will never get merged into branch A, the owner of branch B will always get this difference when pulling from branch A and merging into his own workspace. Even if there's only one such trivial change, the owner of branch B needs to resolve conflicts every time when pulling from branch A. As long as branches A and B are modified independently, more and more conflicts like this appear. What is the workaround for this situation? Which workflow should the owner of branch B follow to minimize the effort for periodically syncing with branch A?

© Stack Overflow or respective owner

Related posts about version-control