Reputation: 96
I have below situation, which I am not getting a solution to.
Say I have cloned a project to my local system. Now, in the project if I do git branch -a
, it lists me say 3 remote branches along with local branches.
Now, after a day, say 10 different developers, pushed 10 different branches to the remote repo. Now, if I do a git branch -a
, it still shows me 3 remote branches.
One solution is to ask each developers to give the name of the branches and I can run the command git pull origin newBrn1
. I have to run this 10 times with the names accordingly.
Isn't there a command which gives me the list that would include the newly created branches in one go?
I tried running git pull
, but throws an error stating:
You asked me to pull without telling me which branch you want to merge with
Upvotes: 4
Views: 7899
Reputation: 536
Fetching the branches from remote will help you. It will sync all the remote tracking branches in your local repository with remote repository. And its console output will let you know about the branches that have been newly created on the remote repository. Here is the command:
git fetch
Read more about fetch
here: https://git-scm.com/docs/git-fetch
Upvotes: 1
Reputation: 30858
git ls-remote
can list references in a remote repository. You may need -h
and use grep
to filter the output.
Upvotes: 0
Reputation: 18825
You can use --all
option to tell that you want to pull all branches:
git pull --all
Upvotes: 4