DEV Community

Cover image for Addressing merge conflicts
Kunwarvir
Kunwarvir

Posted on

Addressing merge conflicts

Introduction

This week I worked on adding more functionality to cli-ssg. I decided to add support for a --lang flag to specify language and add the ability to produce horizontal rule:
Add support for horizontal rule in markdown
Add a -l flag to generate the lang attribute

Working on the features

I created branches issue-13 and issue-15 from main and chose to work on these two issues in parallel. Implementing these features went quite smoothly and I was able to get them working in their respective branches.

issue-13

The code in issue-13 branch allowed the user to specify a -l or --lang flag to indicate the language for the lang attribute.

 -l, --lang        Lang attribute for html element  [string] [default: "en-CA"]
Enter fullscreen mode Exit fullscreen mode

For example: using -l fr would result in the root element being <html lang="fr">

issue-15

The code in issue-15 added support for the markdown syntax for horizontal rule. This allows the tool to render<hr> tags if 3 or more asterisks *, hyphens - or underscores _ are present on a line by themselves.

For example: The following lines would result in a horizontal rule

***
******
---
___
Enter fullscreen mode Exit fullscreen mode

Merging the two parallel branches

Since the features had been implemented, I now had to merge the branches back into main.

Merging issue-13

I started off by merging the first branch issue-13 into main. This went smoothly as git simply performed a fast-forward merge.
89ea750

Merging issue-15

It was then time to merge the second branch issue-15. Since I had worked on these in parallel, I realized that it wouldn't be a simple fast-forward merge. As expected, when I tried merging issue-15 into main using git merge issue-15, there was a conflict in one of the files.
The conflict was actually quite small, and I ended up accepting both changes. After that, I added the file to the staging area and finalized the merge using git commit.
0e1d4c8

Conclusion

After finally merging the two branches back to main, I tested to make sure that the newly added features were both working and it was great to see that everything worked as expected. I ended off by commenting the merge commits and closing the both the issues on GitHub.

Top comments (0)