Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created June 15, 2011 16:08
Show Gist options
  • Select an option

  • Save rwaldron/1027426 to your computer and use it in GitHub Desktop.

Select an option

Save rwaldron/1027426 to your computer and use it in GitHub Desktop.
Count number of branches in a repo
git branch | wc -l
@hovanesgasparian

Copy link
Copy Markdown

Thank you @cedricbastin! And I guess @rwaldron for creating this gist in the first place!

@saylikaranjkar-gep

Copy link
Copy Markdown

Can we get count against a single user in the repo?

@soufian-ze

Copy link
Copy Markdown

You can see the explanation of this command here

@soufian-ze

Copy link
Copy Markdown

@cedricbastin
git branch --all | wc -l this command list both remote-tracking branches and local branches.

@Rikj000

Rikj000 commented Dec 11, 2024

Copy link
Copy Markdown

Count branches:

  • Local only: git branch | wc -l
  • Remote only: git branch --remotes | wc -l
  • All (local + remote): git branch --all | wc -l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment