CoreUI ONE — 250+ PRO components and 25+ admin templates for React, Angular, Vue, Bootstrap and Next.js, plus Data Grid, Scheduler, 4,300+ PRO icons and the Next.js boilerplate. One license. → See what you get

How to checkout a branch in Git

Switching between branches is a fundamental Git operation that allows you to work on different features, bug fixes, or experiments in parallel development workflows. As the creator of CoreUI, a widely used open-source UI library, I’ve performed countless branch checkouts across multiple repositories and collaborative projects. From my experience, the most reliable approach is to use either git checkout or the newer git switch command. Both commands provide safe branch switching with proper working directory updates.

Use git checkout branch-name or git switch branch-name to change to an existing branch.

# Checkout an existing branch (traditional method)
git checkout feature-branch

# Switch to an existing branch (newer method)
git switch feature-branch

# Checkout and create a new branch in one command
git checkout -b new-feature-branch

# Switch and create a new branch (newer syntax)
git switch -c new-feature-branch

# Checkout a remote branch locally
git checkout -b local-branch origin/remote-branch

The git checkout command switches your working directory to the specified branch and updates all files to match that branch’s state. The newer git switch command was introduced to make branch switching more intuitive and separate it from other checkout operations. Use -b with checkout or -c with switch to create and switch to a new branch in one step. When checking out remote branches, create a local tracking branch that follows the remote branch.

This is the same branch switching workflow we use in CoreUI development for managing multiple features and maintaining clean development processes. Always commit or stash your changes before switching branches to avoid losing work or merge conflicts.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.
Migration from Bootstrap 3 to Bootstrap 4
Migration from Bootstrap 3 to Bootstrap 4

How to upgrade Bootstrap 4 alpha 6 to Bootstrap 4 beta
How to upgrade Bootstrap 4 alpha 6 to Bootstrap 4 beta

How to migrate from Bootstrap 3 to Bootstrap 4 Beta
How to migrate from Bootstrap 3 to Bootstrap 4 Beta

What's new in Bootstrap 4 ?
What's new in Bootstrap 4 ?