Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git branch is not showing all the branches

Tags:

git

/opt/lampp/htdocs/drupal-8.4.0$ git branch

I have installed drupal in my system ,I want to switch to other branch but when used git branch is not showing other branches !

like image 379
Mohit Malik Avatar asked Nov 04 '17 17:11

Mohit Malik


People also ask

Why git branch doesnt show all branches?

This can happen if your repo has 0 commits. If you make a commit, your current branch will appear when you do: git branch . Show activity on this post. Sounds like you have a permission issue.

How do I get all branches in a repository?

1 Answer. git fetch --all and git pull -all will only track the remote branches and track local branches that track remote branches respectively. Run this command only if there are remote branches on the server which are untracked by your local branches.

Why is git branch empty?

If you run git branch in the current directory then it will return no branches as the repository is empty and the master branch will be created with the first commit.


2 Answers

Execute git branch -av to show all remote and local branches.

like image 109
Hoang Minh Dung Avatar answered Sep 21 '22 14:09

Hoang Minh Dung


It might be a possibility that you don't have those branches locally.

to pull all additional branches,

git fetch 

it should be like this not like above

git fetch --all or git fetch <branch Name> 

then you can use either checkout or branch to check if it shows

git checkout name-of-the-branch git branch 
like image 41
Irteza Asad Avatar answered Sep 23 '22 14:09

Irteza Asad