Simple Branching and Merging with Git and GitHub

Jared Amlin
Geek Culture
Published in
5 min readApr 23, 2021

--

In my last article, we took a break after making our first push from our local computer to GitHub. Now it’s time to make a new branch. Branches are important for making new developments and thoroughly testing them for bugs before merging them into your main branch. This enables developers to work independently yet simultaneously without changing the main program until everything is ready. Make a new branch by typing “git branch” and then giving the new branch a name. For this example, I will use “dev” to remind me that this is a development branch. If you are working on a feature adding points in a game, you could call that new branch “points”, for example.

After I type “git branch dev” and press Enter, you can see that a new dev branch has been created! The asterisk shows that we are still on our main branch, so I switch to the dev branch by typing “git switch dev”. At the bottom of the image, you can see by entering the “git branch” command, a shortlist populates and lets me know that I am on the dev branch. Perfect!

Alternatively, you can also use “checkout” to change branches, as that used to be the Git default for switch. Here I use “git checkout main”, and “git

--

--

Jared Amlin
Geek Culture

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.