Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get total remote branches in git

Tags:

git

How can I get the total number remote branches in Git?

To get all the remotes branches, I do this statement below, but I cannot get the count/total of these branches. I tried --count, but it didn't work:

  git branch -r

How would I get just the count of these?

like image 915
РАВИ Avatar asked Dec 05 '14 09:12

РАВИ


People also ask

How do I get branches from remote repository?

If you have a single remote repository, then you can omit all arguments. just need to run git fetch , which will retrieve all branches and updates, and after that, run git checkout <branch> which will create a local copy of the branch because all branches are already loaded in your system.

Does git clone get all remote branches?

git clone downloads all remote branches but still considers them "remote", even though the files are located in your new repository. There's one exception to this, which is that the cloning process creates a local branch called "master" from the remote branch called "master".


1 Answers

Something like

 git branch -r | wc -l

using a shell.

wc -l counts the number of line on its input.

like image 175
blue112 Avatar answered Oct 06 '22 18:10

blue112