Merging Branches - lab-03
Krinskumar Vaghasia
Posted on September 23, 2024
This week's lab for a bit tricky for me. I have always ran away from merging my branches and found a way to get around this. I would even do it the hard way by literally creating a new local clone of the repo and merging the changes myself so that I dont have to worry about conflicts or any cryptic messages from github.
I will be continuing my work on the Scrappy which is a command line tool I made during my first lab.
But for this week's lab I decided to actually do it the way its supposed to be done. So I started by creating two issues, #6 for the addition of proper exit codes and. #7 for a new stream flag. I made new branches for each issue and worked on these branches locally in parallel. As for the development, I had to onboard myself on my own repo because in last lab, on of my classmate worked on my repo so there were a lot of new changes for me. But after I understood the code, the actual development in the branches was fairly straightforward.
After the development was done, I merged my issue-6 branch using git merge issue-6
and the merge was successful because it was a fast forward merge. I did the same for issue-7 using git merge issue-7
, but this time I saw the dreaded merge conflict. I made an effort to understand what was on the screen. There was new tab on my visual studio code with three screen, Before, After, and New. After playing around a bit and doing some google searches I figured out that the Before tells us what the code used to look like before merge, After tells us what the code in the new commit that is to be merged looks like and lastly the new tells us what the end result after a successful merge would look like. It also highlighted the specific parts of the code that had the changes. I made the changes to fix the conflict in this tab itself. This resulted is a new commit to fix the merges.
Overall the merges were smooth with no major issues. I also learned how to deal with merge conflicts. #6 was merged by this commit and #7 was merged by this commit.
Posted on September 23, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.