Useful Git Snippets

04-05-2021

Here are some useful Git snippets

Get a count number of the number of branches for a repository.

1
git branch | wc -l

Include the --all flag to get both local and remote branches

1
git branch --all | wc -l

List all branches not merged into another branch, i.e. main

1
git branch --no-merged main