How to See All Branches in Git: A Quick Guide

When working with Git, branches help you manage different lines of development. At times, you’ll want to list all branches available both locally and remotely to get a clear picture of your repository’s structure.

This guide shows you how to easily view all branches in Git.


✅ View Local Branches

To see all branches stored locally on your machine:

git branch

This lists all your local branches and highlights the current branch with an asterisk (*).


✅ View Remote Branches

To list branches available on the remote repository (like GitHub):

git branch -r

This will show remote tracking branches, usually prefixed with origin/.


✅ View All Branches (Local + Remote)

To see both local and remote branches together:

git branch -a

This lists all branches, showing local branches plain and remote branches prefixed with remotes/.


✅ Additional Tips

  • Use git checkout branch-name or git switch branch-name to switch between branches.
  • To get detailed information on branches and their last commits:
git branch -vv

🧩 Summary of Commands

TaskCommand
List local branchesgit branch
List remote branchesgit branch -r
List all branchesgit branch -a
List branches with detailsgit branch -vv

📌 Final Thought

Regularly checking branches helps keep your workflow organized, especially when collaborating on large projects with many contributors.

Sharing Is Caring:

Leave a Comment