notwaldorf / ama

:raising_hand: Ask @notwaldorf anything!
94 stars 13 forks source link

Merge conflict #42

Closed amitmerchant1990 closed 8 years ago

amitmerchant1990 commented 8 years ago

Just want to know how do you solve a complicated merge conflict?

notwaldorf commented 8 years ago

Patience, patience, patience.

I'm a bit lucky right now because I work on a project where the code is distributed across very many repos, so the merge conflicts within one repo are fairly rare, and easy to fix. When I worked in Chrome, however, it would happen that I would work on a very popular file, that would change daily -- those merge conflicts were pretty brutal.

To be fair, I don't have any good advice. I don't know if there's any tools that help with it -- I just go through every conflict by hand, and reason about which bit should I leave in (my code, the master code, or a bit of both). Having small-ish commits tends to help, since they're easier to reason about.