Methods a

Git gets all branches from a remote repository

git clone xxx
git branch -r | grep -v '- >' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
Copy the code

Method 2

Git clone can only clone the master branch of the remote repository. Git clone can only clone the master branch of the remote repository.1.Find a clean directory, say git_work1.  cd git_work
1.  git clone [http:/ / myrepo.xxx.com/project/.git] (), so get a project in git_work directory subdirectory
1.  cd project
1.Git branch -a, list all branch names as follows: \ remotes/origin/dev\ remotes/origin/release1.Git checkout -b dev origin/dev git checkout -b dev origin/dev git checkout -b dev origin1.Git checkout -b release origin/release1.Git checkout dev, switch back to the dev branch and start development.Copy the code