Creating Branches: How to Use Git Branch to Manage Workflows
Learn how to use git branch to create, list, and manage independent lines of development. Master the core branching workflow to organize your project today.

Previously in this course, we learned how to navigate your commit history using navigating-commits-mastering-git-checkout-and-head. Now that you can move through time, it’s time to learn how to move through parallel universes.
In professional software development, you never work directly on your "production-ready" code. Instead, you use branching to isolate your changes. This lesson covers how to create new branches and list existing ones using git branch.
Understanding Branching from First Principles
Think of your repository as a timeline. By default, Git gives you one timeline called main.
When you branch, you are essentially taking a snapshot of the current state of your project and creating a new, independent path. Any commits you make on this new branch do not affect the main branch. This allows you to experiment, fix bugs, or build new features without risking the stability of your core project.
The git branch command is your primary tool for managing these timelines. It doesn't switch you to the branch—it simply creates the pointer or lists the ones you already have.
Creating and Listing Branches
To see what branches currently exist in your project, run:
Bashgit branch
This will output a list of your local branches. The branch marked with an asterisk (*) and usually highlighted in color is the one you are currently "on."
Creating a New Branch
To create a new branch, you provide a name to the command:
Bashgit branch feature-login-page
This creates a new pointer named feature-login-page that points to the exact commit you are currently standing on. Crucially, this command does not switch you to the new branch. Your terminal is still "pointing" to your previous branch (usually main).
Verification
After running the command above, check your list again:
Bashgit branch
You will see:
mainfeature-login-page
The asterisk will still be next to main. You have created a new branch, but you haven't moved into it yet.
Hands-on Exercise
Let’s apply this to your running project. Open your terminal in your project directory and follow these steps:
- Check your current branch: Run
git branchto confirm you are onmain. - Create a new branch: Name it
add-readme-descriptionby runninggit branch add-readme-description. - List your branches: Verify that both
mainandadd-readme-descriptionappear in the list. - Observe the active branch: Note that the asterisk is still beside
main.
Common Pitfalls
- Forgetting to Switch: Beginners often create a branch and immediately start typing code, forgetting they are still on
main. Always check your status withgit statusorgit branchbefore you start working. (We will cover how to switch branches in the next lesson). - Naming Conventions: While you can name a branch anything, avoid using spaces or special characters. Use hyphens or underscores (e.g.,
feature-headerorbugfix/login-error) to keep your workflow clean and CLI-friendly. - Creating a Branch from the Wrong Commit: Remember that
git branchcreates a branch based on your current location. If you want to branch off a specific past commit, you must navigate there first using navigating-commits-mastering-git-checkout-and-head.
FAQ
Does git branch move me to the new branch?
No. It only creates a new pointer. You need a separate command to switch your working directory to the new branch.
Can I have multiple branches with the same name? No, branch names must be unique within your local repository.
What happens if I delete a branch? If you delete a branch, the commits associated with it remain in the database (unless they aren't reachable by any other branch), but the pointer to that timeline is removed. We will discuss safe deletion in a later lesson.
Recap
Branching is the cornerstone of a collaborative, professional workflow. By using git branch, you create isolated environments where you can experiment safely. Remember: git branch creates the lane, but it doesn't put you in the driver's seat.
Up next: We will learn how to switch into these branches and start making changes using git switch.
Work with me

AI Automation & Agentic Workflow Development
Automate the repetitive work eating your time — content pipelines, data workflows, and agentic AI tasks that run themselves.

FilamentPHP Admin Panel & Dashboard Development
A powerful admin panel for your Laravel app — built with FilamentPHP so you can manage everything without touching the database.


