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?

  • 3
    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. – Robert Harvey Feb 13 at 17:37
3

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.

New contributor
Mecki is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.