Lab 3 - Branch Merging.

aldrin312

aldrin312

Posted on September 28, 2024

Lab 3 - Branch Merging.

For this lab we needed to add two new feature for our project (Auto commenting tool) but we have to do it in separate branches. Which I understand, when changes are being made, it should never be done on the main or master branch. If its done their, it can potentially break everything.

New Features in branches.

The 2 new feature I need to add was only allow certain file extensions and allow users to directly input their api in the cli command like this autocomment -api <api-key> <filename>. Instead of committing these in the main branch, I needed to put them in their own separate branches. This make sure that not the changes doesn't break everything, where potentially loosing a lot of the work done.

The Merges.

The implementation of the two new features wasn't too hard to make, I just need to merge them now. The first merge with one of the branches went smoothly, I just fast-forward the main branch onto one of the branches I implemented one of the features on, 917d57c. The next merge I need to do is a different. Since the main branch has now changed, it created conflicts with the second branch I made. I have to do a three way merge, where I need to fix all of the conflicts and pick which changes to keep. I messed up on couple of the changes where I accepted the wrong one. Thankfully they were minor and an easy fix, 985ace8. Other than those minor issues, their wasn't much of a problem.

Thoughts

Merging is a bit scary. If it was just fast-forwarding it, that's fine, but if its a three way merge, its a bit intimidating. I need to pick all the right changes. At the moment its still a bit confusing for me, but the more I do it, it should start to make sense to more. After I did the merges, I later learned that I can make a test branch for the merges. That way the main branch stays protected. If I mess up on the merges I can just delete the branch, but if I did everything right I can simply fast-forward the main branch to it. Since the their shouldn't be any conflict with the main branch.

💖 💪 🙅 🚩
aldrin312
aldrin312

Posted on September 28, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related