How to list branches in Git

Listing branches is essential for navigating Git repositories, understanding project structure, and managing multiple development streams in collaborative workflows. As the creator of CoreUI, a widely used open-source UI library, I regularly list branches across multiple repositories to track feature development, review contributor work, and manage release branches. From my expertise, the most comprehensive approach is to use git branch with various flags for local and remote branch information. This method provides complete visibility into repository structure, branch status, and tracking relationships for effective branch management.

Use git branch command with flags to view local, remote, and all branches in the repository.

git branch          # List local branches
git branch -r       # List remote branches
git branch -a       # List all branches (local + remote)
git branch -v       # List with last commit info

The git branch command shows all branches in your repository with the current branch marked by an asterisk (*). Use -r flag to see remote branches from origin and other remotes, or -a to see both local and remote branches. The -v flag adds verbose output showing the last commit hash and message for each branch. Remote branches appear with their remote name prefix like origin/main. This helps you understand the complete branch structure and identify available branches for checkout or merging.

Best Practice Note:

This is the same approach we use in CoreUI development for navigating complex branch structures and managing multiple contributors. Use git branch --merged to see branches that have been merged into the current branch, and git branch --no-merged to identify branches with unmerged work for cleanup and maintenance.


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