My manager recommended I consider the technique of 'branching by abstraction', in which, rather than creating feature branches, multiple developers work in the same version control branch, and abstract the functionality they are working on e.g. using feature toggles.

I'm sceptical about this approach, but feel obliged to consider with at least a semblance of fairness. One of my major concerns regards code review. The developers in my team use pull requests to review each other's code. Without branches, this approach would be unavailable.

My question is, if one were to apply this technique, how could code review be accomplished (easily)?

  • Sit down with your colleague and review the code. I'm not particularly in favour of 'branch by abstraction', but one of its advantages is that the new code is right there in trunk, working, integrated, tested, and isolated. – Benjamin Hodgson Jan 21 '15 at 22:20
  • So how, practically, would you identify the code in question? Diff the developer's commits against the commit before he started? In the real world, developers tend to switch between tasks, so it might get pretty messy trying to figure out which commits are relevant... – micapam Jan 21 '15 at 23:52
  • 1
    @micapam: since all commits go to the trunk, all of them might be relevant (and is not any code changed worth reviewing?). And yes, the VCS should be consulted to identify which classes and functions are touched. But when reviewing code, IMHO one should look at the actual code of a specific function, not just at the "diffs". – Doc Brown Jan 22 '15 at 7:12

Our team uses the Gerrit code review system, where reviews are based on commits, instead of branches. The learning curve of Gerrit is higher than pull requests, but it creates a much cleaner commit history and allows for fine-grained commenting on code.

Our local repositories still contain branches, but 95% of our commits end up directly on the 'develop' branch.

For larger features, where considerate change in database structure or impactful refactors are necessary, we still use feature branches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.