How do you handle the tension between refactoring and the need for merging?

Posted by Xavier Nodet on Stack Overflow See other posts from Stack Overflow or by Xavier Nodet
Published on 2008-10-14T11:16:20Z Indexed on 2010/05/20 8:40 UTC
Read the original article Hit count: 220

Hi,

Our policy when delivering a new version is to create a branch in our VCS and handle it to our QA team. When the latter gives the green light, we tag and release our product. The branch is kept to receive (only) bug fixes so that we can create technical releases. Those bug fixes are subsequently merged on the trunk.

During this time, the trunk sees the main development work, and is potentially subject to refactoring changes.

The issue is that there is a tension between the need to have a stable trunk (so that the merge of bug fixes succeed -- it usually can't if the code has been e.g. extracted to another method, or moved to another class) and the need to refactor it when introducing new features.

The policy in our place is to not do any refactoring before enough time has passed and the branch is stable enough. When this is the case, one can start doing refactoring changes on the trunk, and bug-fixes are to be manually committed on both the trunk and the branch.

But this means that developpers must wait quite some time before committing on the trunk any refactoring change, because this could break the subsequent merge from the branch to the trunk. And having to manually port bugs from the branch to the trunk is painful. It seems to me that this hampers development...

How do you handle this tension?

Thanks.

© Stack Overflow or respective owner

Related posts about version-control

Related posts about refactoring