Navigating Git Branches Like a Pro: The Git Branch Command

I’m a code mapache, subtly mastering the forest of Git branches. Let’s talk git branch, remote vs. local branches, and git prune.

Dr. Derek Austin 🥳
git happy
Published in
6 min readNov 19, 2023

--

I thought Git branches were for sleeping and looking cute? Photo by Chalo Garcia on Unsplash

As a professional software developer, you might have noticed a few similarities between your codebase and a community of mapaches 🦝. They’re both intricately organized, require patience to understand, and have a lot of hidden treasures waiting to be discovered.

In this article, I’m going to take you through the woodland pathways of Git branches, using both the command line and GitHub Desktop. And yes, our guide through this adventure will be a code mapache, because (hissing)!

The Basics of Branching in Git

Branching is an integral part of Git version control. It allows developers to work on different features simultaneously without disrupting the main line of development, which is usually the main branch (or sometimes develop).

# Let's create a new mapache branch!
git branch "new_mapache_branch"

# Let's switch to (or "check out") our new branch.
git checkout "new_mapache_branch"

After doing the work on this new branch, it can be merged back into the main (or develop) branch, either…

--

--

Dr. Derek Austin 🥳
git happy

I write about real-world programming career advice, MongoDB vs. PostgreSQL, Git, React, JavaScript, VS Code, TypeScript, and Next.js. Doctor of Physical Therapy