git - How to pull a branch from remote when you accidentally deleted local branch? -
i have 3 branches , have pushed 3 branches remote git [ aka bitbucket using bb]. deleted branch locally using git branch -d <branch-name>
i did git push . want branches present in local system.
since pushed branches can create local branch tracking remote with:
git branch --track <local branch name> <remote branch name>
your remote branch names origin/foo
, can see list of them git branch -r
https://www.kernel.org/pub/software/scm/git/docs/git-branch.html
for adding remotes in 1 line can following:
git branch -r | egrep -v "(head|master)" | sed -e "s/origin\///" | xargs -i % git branch --track % origin/%
this gets list of remote branches except head , master. creates new local version same name track remote.
Comments
Post a Comment