DEV Community

Tuan Thanh Tan
Tuan Thanh Tan

Posted on

Working with parallel branches in Git


Hello everyone, my name is Dustin, today I want to write a blog about my progress of working with branches in Git. So this is the lab 03, which I have to create 2 parallel branches to work on different aspects of the program.

The progress

First off, I needed to decide what to add to my program. At the time, I had a few options like changing code block, or hr, or exit code for my program... So I thought that the exit code is a must that my program needed to have and the code block thing is quite more interesting than hr. After choosing what I needed to do, I had to file 2 issues so I had something to refer back to.

The 2 issues I was talking about:
First one
Second one

Writing code for these 2 issues are quite straightforward. It took me a few minutes to finish it. However, I'm not so sure about the inline code block thing, and should ask my professor about it to make sure that's what he's looking for.

So, for the first issue, I created a new branch called issue-18 and issue-19 for the second issue. When finishing the first issue, I had to git add and git commit and switched to branch issue-19 to continue coding. As I've done it, I also had to git add and git commit. After that, I had to use merge to merge those 2 branches.

Merging branches

I used git merge issue-18 which is my first issue, git had no problem merging it. It was fast forward right away. However, for the second issue, when I git merge issue-19, instead of fast forward, Git used three way recursive strategy. Then, I just needed to push it to github so the code will be visible to everyone.

Project Repo
Commit 1
Commit 2

Discussion (0)