DEV Community

JLi
JLi

Posted on

Parallel updates

This week's lab we were given the task of using different branches to add separate features to our SSG. Once these features were implemented in their individual branch we were to merge them together and deal with any merge conflicts we had. Thankfully for me I had plenty of experience with dealing with merge conflicts due to the struggles I had with last week's task.

I decided the two features I wanted to add were things related to the markdown functionality of my SSG. I added support for inline code using the ` syntax and I also added support for the horizontal rule "---" syntax. Thanks to my classmate Gus, it was really easy to augment the existing code to add new features to the markdown support. All I had to do was add some if statements in the markdown handler section of the file reader to check for ` and --- then I just needed to add a new function for inline code generation. You can find the changes for the inline code implementation here and the horizontal rule implementation here.

When I started to merge the different branches together the first one was merged with the main branch no problem. However, when I tried to merge the second one I got into some merge conflict issues. This is where I learned that Visual Studio automatically sensed what I was trying to do and gave me a cool merge conflict solver. It allowed me to choose what conflicting code blocks I wanted to stay in the merged version; just by clicking a checkbox next to it, and also directly change code line by line if I wanted. That made fixing the conflicts incredibly easy to do. Then from there I merged and pushed my changes from both branches onto my main branch with no issues. In that merge you can also see the two parent commits as well:
image
This lab went pretty smoothly thanks to Gus' initial implementation of the markdown support. The code was kept pretty simple and not many changes were needed to implement new features. There wasn't much I think I would have done differently to be honest, the merge conflict was something I think would always happen because they are separate branches working on the same file. Thus I think everything went perfectly.

This was a nice lab that helped me understand the process of making different features in parallel and then merging them at the same time. I also got to learn about the merge conflict feature in Visual Studio, which was really neat. I only ever worked with Git using Visual Studio Code for web development so I'm really happy I'm learning to use Git with C++. Anyways thanks for reading! Take care!

Top comments (0)