DEV Community

Bryce Seefieldt
Bryce Seefieldt

Posted on

Working with parallel branches and merges

Today I took on adding some more markdown conversion functionality to my ez-txt2html converter. I worked on adding functionality that recognizes markdown’s horizontal rule tag --- and converts it to html </ hr>. As well I added inline code tag conversion that recognizes and converts single tick inline code tags to <code>…</code> html tags, along with triple tick fenced code blocks which can support a multiline code block in the resulting html doc. The biggest challenge in incorporating this functionality was to be able to open the fenced code block on a given line of text and then close it later in the document. This is because my method of recognizing and replacing markdown tags works line by line and required a Boolean flag to indicate whether the current occurrence of the triple tick should be replaced by an open code or close code block tag (<code> or </code>). As well it was important to convert fenced code blocks (triple tick) prior to addressing inline single tick tags, otherwise fenced code blocks would be confused as multiple single tick tags.
As an exercise in working on parallel branches, I worked on horizontal rule and inline code functionality on separate branches and waited until both issues were complete to merge my commits on each respective branch. It was a fairly straightforward process, with just a few conflicts generated in my attempt to merge the second branch. This was easily resolved using the conflict review tools provided in both GitHub and codespaces. By accepting both incoming changes I was able to successfully merge the branches and create 2 pull requests (PR17 and PR18). You can see the detailed steps outlining the commits and the merge process in commits cdcf8b5 and a599961. While the merge process wasn’t overly complicated, it does take some time to make sure you are assessing the conflicts in detail and not approving unwanted code or eliminating desired code in the process. I found the conflict review tools on GitHub itself to be the most streamlined and user-friendly method to approving conflicts to succesfully merge branches. As well I found this GitHub Docs – Resolving a merge conflict using the command line and Rohan Dawkhar’s Medium article - Resolving Merge Conflicts (GitHub): A Step-by-Step Guide to be very helpful walkthroughs in order to understand merging.

Top comments (0)