Reputation: 21
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
Reputation: 5643
It's difficult to avoid these types of merge conflicts. You have two options that I see:
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.
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