Diversion
Published: 2021-10-02 00:59:37

This week we got to tackle my favourite thing in the world - merging!
![](https://i.pinimg.com/originals/c9/94/e8/c994e8feef7b9ba633ad49357d3a29ad.gif)

If you read my previous post, you know how nervous I get about anytime I see there needs to be a merge. This week, by taking the steps and time to understand how to create a merge conflict, I felt a lot more comfortable when it came time to merge. 


## Picking Features
I decided to implement the following features:
1. [Issue 18: Support Lang flag](https://github.com/AmasiaNalbandian/static-site-generator/issues/18)
2. [Issue 19: Support code blocks from backticks](https://github.com/AmasiaNalbandian/static-site-generator/issues/19)  

I was really nervous about the language flag, as I knew my code had some faults in the way it was taking in the --input flag already. I told myself - focus on the language flag and not on the cli portion. I approached this and was shocked at how effective I was in completing it. I first began by implementing the flag. for now only --lang can be used and there is no --l flag. I then implemented a feature to parse the words after input, and lang flags. Once I did this in both directions (--i then --flag or --flag then --i) the rest was smoooooooooth sailing. I accidentally enabled users to create files in multiple languages by just adding more options after the flag - this was cool! Until I realized I was overwriting the same file - hahaha. I instead added a feature to then create the directory in the dist file in the language of choice so there were copies made of each file in html by language. 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0jshxaoo2rwttxoxlvuv.png)

The second feature added was really simple - and just two lines of code. Replace the encased backticks with `<code>` tags.
 

## Merging
When it came time to merge, I decided to merge the bigger commit first so that I might have less merge conflicts trying to push the second feature that's two lines long. The first merge was done through fast-forward and then the second one was done through recursive strategy. I thought I did this wrong so I tried it again with the readme in the branches. I went back into each branch and I changed the readme files. This time, after I merged the first branch, I made sure to not push yet and merge the other branch too, then merge all together. I thought this was what caused the recursive merge and avoided the three way merge, but it wasn't.

## Looking back
Through all these actions and adventures, I learned something really important - the actual reason I don't like merging and merge conflicts. By understanding how simple a fast forward merge is, I can try my best to do these more often. By understanding how 3-way merges occur and can be fixed, my approach to solve the conflicts are much hopeful. After reading this [answer](https://stackoverflow.com/questions/4129049/why-is-a-3-way-merge-advantageous-over-a-2-way-merge) to what a 3-way-merge is, I see that it's not always going to be worst case scenario. Through understanding how this works, I feel more confident approaching merge conflicts.


![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yw1al942lehmnexyuaci.png)