DEV Community

Roy J. Wignarajah
Roy J. Wignarajah

Posted on • Edited on

First Merge

This week's post is a few days late, and will be shorter than usual.

Links Mentioned

My Project: ctil

Issues:

Merge Commits:

Lab Exercise 3

In my Open Source class, we had another lab exercise designed to give us experience working on parallel branches and merging branches. This exercise would ultimately give experience in the following:

  • creating many branches to work on new features and fix bugs
  • working on many code changes in parallel on separate topic branches
  • adding features to existing code
  • doing fast-forward and three-way-recursive merges using git merge
  • fixing merge conflicts
  • finding and identifying commits on GitHub

Ctil New Features

For the exercise, we had to work on adding two separate features to our project in parallel branches. For my project, ctil, I decided to add the following Markdown-to-HTML conversion features:

  • Horizontal Break Conversion
  • Code Block Conversion

I also wanted to add support for a language flag that would modify the lang attribute on the root <html> element of generated HTML documents, but decided to work on it another time as I am still trying to implement flag support.

First Merge Experience

For this exercise I worked on each feature one at a time. Implementing the above conversion features was manageable, largely because I was able to implement similar logic provided by a classmate who contributed to ctil earlier.

Properly merging both branches into my main branch was a challenge. The initial fast-forward merge of the Horizontal Break conversion was successful and did not give any issues. However, merging my second addition required a three-way recursive, which was a little challenging. The features I wanted to add were different, but I think because the additions were made to the same files that merge conflicts arose. This was an issue because I wanted to accept both sets of code while preserving the integrity of both additions inside the main branch (without changing the code order of any method) Although Visual Studio 2022 provides a Merge Editor to help resolve conflicts, I was unable to accept both sets of code without properly reserving my added methods. If the merge conflict involved code that a colleague wrote, I would have aborted the merge attempt and reattempted it with the colleague around. However, since I wrote all the code involved and knew what the code should look like and do, I decided to accept the three-way recursive merge and manually fix the broken code (available at a36c6bd).

Top comments (2)

Collapse
 
erikwhiting88 profile image
Erik

Very cool, I wish I had a class like your open source class when I was in undergrad

Collapse
 
rjwignar profile image
Roy J. Wignarajah

Thanks for reading my blog, Erik!
I'm really happy to be taking this class, it's forced me to leave my comfort zone and to quickly learn a bunch of topics. I can't wait to share what else I'll learn in the next couple of months.