Git Merge Therapy

Merges are okay, alright? Cool.

Image

Have a seat on the sofa for a moment, please. I want share some­thing impor­tant with you. 

Ready?

Git merge con­flicts are nor­mal and okay. 

They are sup­posed to hap­pen and, most like­ly, will hap­pen reg­u­lar­ly. They don’t hap­pen because you did some­thing wrong. They hap­pen because Git is try­ing to pro­tect you from los­ing your hard work.

If you’re new to Git or haven’t done exten­sive work with it in a team envi­ron­ment then you prob­a­bly haven’t had the expe­ri­ence of a lot of merge conflicts.

In a future arti­cle I will share how you can resolve con­flicts but right now, let’s talk about prevention.

We can do some things to pre­vent con­flicts; here’s a list of a few:

  • Ignore gen­er­at­ed files
  • Ignore cache or oth­er run­time direc­to­ries and files
  • Have a good branch­ing strategy
  • Avoid white­space errors

I’ll go into each one in detail in future articles.

Until then: Git con­flicts are okay!