First Merge
Tags: osd600
Published: 2023-10-03 04:20:32

This week's post is a few days late, and will be shorter than usual.
### Links Mentioned
#### My Project: [ctil](https://github.com/rjwignar/ctil)

#### Issues:
- Issue 5, Horizontal Break Conversion: [https://github.com/rjwignar/ctil/issues/5](https://github.com/rjwignar/ctil/issues/5)
- Issue 7, Code Block Conversion: [https://github.com/rjwignar/ctil/issues/7](https://github.com/rjwignar/ctil/issues/7)

#### Merge Commits:
- For Issue 5: [ea73b83](https://github.com/rjwignar/ctil/commit/ea73b838723d45872be2c66563e6758cae709e3d)
- For Issue 7: [2db15e1](https://github.com/rjwignar/ctil/commit/2db15e16ac9acbab5866c4f7816a46f4d534af53)

## 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](https://learn.microsoft.com/en-us/visualstudio/version-control/git-resolve-conflicts?view=vs-2022) 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](https://github.com/rjwignar/ctil/commit/a36c6bda4c516f7b64a9211d305d743f87e48898)).