DEV Community

Minh Hang Nguyen
Minh Hang Nguyen

Posted on

Merges and conflicts

New features

In the last update, my friend - Dustin - helped to add Markdown as a valid input for my tool. Markdown syntaxes are different from HTML syntaxes and he has worked on converting some of them. This time I decided to add two more:

  1. inline code

  2. horizontal rule

The implementation was quite simple. I created two regex to find any instances of the single backticks and ---, then used replace() to update them into <code>...</code> and <hr> respectively.

Working with merges

I created two new branches for the two features so I could work on them separately. The first branch to resolve issue-8 was a simple fast-forward merge.
As I tried to merge the second branch, the terminal gave me a warning message of conflict. I used VSCode to compare the differences and decided that I needed both changes. I realized that even if I choose Accept both changes in VSCode, I still need to double check and modify the code so that the two changes would fit together. Then the second branch was successfully merged with the 3-way recursive merge into the main.

Final thoughts

This week, I've got a better idea of how branches and commits connect with each other. I also learned how branches work, how they are created and merged.
When seeing the conflict, I also tried using git diff to identify the conflicts. It's a quick way to review if the difference is small (eg: a few lines of code), but I think it would be overwhelming if the 2 branches have lots of difference. In such cases, using other text editors that provide visual comparison (eg: VSCode) can make it much easier to track the changes since we can compare them side by side.

Discussion (0)