1

In my team, we use git branching to keep different features separate (of course). However, one co-worker insists on keeping these features in different files as well to avoid merge conflicts. For example, we may have a FormView.java on master, but in have both a FormView.java and a ValidatedFormView.java on the form-validation branch. I suggested that rather than duplicating files to "work around" git, we should let git do its thing and merge features when we want to. He also wants to keep duplicates in order to be able merge some parts of a feature into other branches without having to deal with merging the FormView.java file itself.

What should we do? If he is right, why? If I am right, how can I convince him as such?

1
  • 4
    However, one co-worker insists on keeping these features in different files as well to avoid merge conflicts. -- No, that is a bad idea, unless the intent is to actually create a new feature that co-exists with the original. The way to minimize merge conflicts is to keep more than one person from working on the same file at the same time. In other words, coordinate your efforts. Your coworker needs to stop trying to work-around the way Git works. Feb 13, 2020 at 17:37

1 Answer 1

5

If merge conflicts would be seen as a problem in general, version control systems would not allow them to happen in the first place. Yet, they don't just allow them to happen, they even help you to deal with them. This implies that merge conflicts are expected to happen and seen as a normal event when working with version control systems.

And version control systems are used in projects with thousands of participants spread around the world; it would be impossible to apply a system as your coworker suggests to such kind of projects. So how can these projects even exists and be successful if merge conflicts would be such a huge problem? They have merge conflicts several times a day.

Being able to effectively deal with merge conflicts is a core competence for every developer today. Any time spend in avoiding them is wasted time IMHO and should better be spend on training resolving them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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