I have a question regarding the GitHub flow and specifically about how to manage multiple features developed at the same time.
Let assume we have a simple CSS file.
.container{
height: 500px;
width: 500px;
background-color: blue;
color: white;
}
Let assume developer A is in charge of changing the background color to red while developer B is in charge of changing the font color to black.
Developer A creates its feature branch "red-background", updates the CSS file and commits the change in its branch. The CSS file in "red-background" branch is now:
.container{
height: 500px;
width: 500px;
background-color: red;
color: white;
}
Developer B creates its feature branch "black-font", updates the CSS file and commits the change in its branch. The CSS file in "black-font" branch is now:
.container{
height: 500px;
width: 500px;
background-color: blue;
color: black;
}
Now if the reviewer merges "red-background" to main and then "black-font" to main, a git-merge conflict arises :
.container{
height: 500px;
width: 500px;
<<<<<<< HEAD
background-color: red;
color: white;
=======
background-color: blue;
color: black;
>>>>>>> black-font
}
How to avoid conflict in those types of situations?