DEV Community

Ritik Bheda
Ritik Bheda

Posted on

Resolving merge conflicts

I continued working on my commandline-ssg application this week, adding two new features and performing git merge on parallel branches. The features were simple to implement, and then when I sought to conduct a three-way recursive merge for my readme file, I only had a few of conflicts to deal with.

New features

I selected two features to work on for this week. the features are as follows:

Exit code

I started it by creating issue. Then I created a branch called issue-10. I then started with coding and added exit statements on every places where program do not run further or do not run as expected. I committed the code and later I updated the README.md file and committed it as well.

Language support

I started by creating issue. Then I created a branch called issue-11. I then started with coding and my solution to it was introducing a new option with a default value of en-CA. I then edited all the occurrence of the language in the HTML code. Later, my code looked a little mess so all I now had to make it look prettier and easily understandable for a developer. My solution to it was passing only one function argument instead of 4. I updated the README.md file and committed everything. This is the commit link.

Merging the code

I first merged the issue-10 which was fast-forward meaning I did not have any merge conflicts or anything to deal with. It was an easy process. But after that, I tried merging the issue-11 to my master branch but it had merge conflicts in a couple of files. I solved them in one file, I did keep both the changes while in the second, I have to keep a mixture of both. This commit is resolves the merge conflicts. The master branch now has code from both issue-10 and issue-11 branches and both the branches are not already deleted.

Learnings

All these events taught me something really valuable. I can do my best to perform them more regularly now that I know how simple a fast forward merging is. My approach to resolving disputes is lot more hopeful now that I understand how 3-way merges occur and may be rectified. After reading this explanation of what a 3-way-merge is, I realize that the worst-case situation isn't necessarily the case. I feel more secure addressing merge disputes now that I understand how this works.

Other links

Project Repo
My GitHub account

Top comments (0)