shogun21
shogun21

Reputation: 21

Avoid merge conflicts in stylesheets

Most of the time, merge conflicts are not a major issue. However, for my team, it's become a problem in our main stylesheet where we all append new classes to the bottom of the file. This leads to merge conflicts in github.

What are best practices when organizing .css files to avoid merge conflicts?

Upvotes: 2

Views: 1463

Answers (1)

Justin Howard
Justin Howard

Reputation: 5643

It's difficult to avoid these types of merge conflicts. You have two options that I see:

  1. Use a custom merge driver. See strategy for git and append-mostly files. This is fairly complex and I haven't done this myself. Personally I see too much potential for work magically disappearing.

  2. Split your css into multiple files. You could then use something like grunt with cssmin to compile them into a single file. This wouldn't eliminate the issue entirely, but it reduce conflicts enough to be manageable.

Upvotes: 1

Related Questions