Reputation: 6320
I have 3 branches and i have pushed all the 3 branches to remote git [ aka bitbucket am using bb].
I deleted a branch locally now using
git branch -d <branch-name>
I did a git push also . But now i want all the branches to be present in my local system.
Upvotes: 1
Views: 1003
Reputation: 43690
Since you pushed the branches you can create a local branch that is tracking the remote with:
git branch --track <local branch name> <remote branch name>
Your remote branch names will be something origin/foo
and you can see the list of them with git branch -r
https://www.kernel.org/pub/software/scm/git/docs/git-branch.html
For adding all the remotes in one line you can do the following:
git branch -r | egrep -v "(HEAD|master)" | sed -e "s/origin\///" | xargs -I % git branch --track % origin/%
This gets a list of all the remote branches except HEAD and master. Then creates a new local version with the same name that will track the remote.
Upvotes: 1