: One solution to solve the problem is to resolve the merge conflict by using the command line.
1. Open Git Bash
2. Navigate into the local Git repository that has the merge conflict with the command: “cd REPOSITORY-NAME”
3. Generate a list of the files affected by the merge conflict with the command “git status”.
4. Open a text editor and navigate to the file that has merge conflicts.
5. To see the beginning of the merge conflict in your file, search the file for the conflict marker “<<<<<<<”.When you open the file in your text editor, you'll see the changes from the HEAD or base branch after the line <<<<<<< HEAD. Next, you'll see =======, which divides your changes from the changes in the other branch, followed by >>>>>>> BRANCH-NAME.
6. Decide if you want to keep only your branch's changes, keep only the other branch's changes, or make a brand new change, which may incorporate changes from both branches. Delete the conflict markers <<<<<<<, =======, >>>>>>> and make the changes you want in the final merge.
7. Add your changes with the command “git add”
8. Commit your changes with git commit –m “message”
Now you can merge your branch.
Comments
This answer is certainly helpful if you are stuck to text editors. Though, I would recommend using an IDE which has integrated git support (e.g. IntelliJ) or a dedicated git tool for solving such conflicts. These tools highlight merge conflicts and simplify solving them by providing a graphical user interface. This has helped me to save a lot of time.