DEV Community

Thanh Van
Thanh Van

Posted on

Working with Branch and Merge

This week I have to add another two features in my program, which is inline code block and horizontal rule. To be honest, I am able to know Git can do so many things out there, working with multiple branches in parallel is an example of this week.

Speaking of the inline code block, I simply added another regex inside my splitInParagraphs function, which finds the text enclosed with backtick and then converting it to <code>..text..</code>. Thanks to my previous lab, I already had the idea of adding new features inside my program later one. I also use another regex to support converting --- to <hr> tag.

When I satisfy and try to test my program, everything works perfectly as I expect, then merging into my main branch. At first, the inline code block was merged smoothly with a fast-forward. However, when I merged the horizontal rule, it caused conflict because I modified the file for the second time with different issue, the content of the file is newer so it did not allow me to merge at that time. Conflict
Thankfully, VSCode is really amazing, it detects my problem, and it shows some options I could do, which is Compare or Overwrite. I try both option in order to know the reason why I could not merge my second branch. I fix it by overwriting on my current file, and the branch is merged successfully.

This lab gives me a chance to practice with merge conflicts, and I am able to know what to do when I face the same problem again.

Discussion (0)