git branch - Comment cloner toutes les branches distantes de Git

Mots clés : gitgit-branchgit-cloneremote-branchgit

meilleur 5 Réponses git branch - Comment cloner toutes les branches distantes de Git

vote vote

97

$ git clone git://example.com/myproject $ cd myproject 
$ git branch * master 
$ git branch -a * master   remotes/origin/HEAD   remotes/origin/master   remotes/origin/v1.0-stable   remotes/origin/experimental 
$ git checkout origin/experimental 
$ git checkout experimental 
Branch experimental set up to track remote branch experimental from origin. Switched to a new branch 'experimental' 
$ git branch * experimental   master 
$ git remote add win32 git://example.com/users/joe/myproject-win32-port $ git branch -a * master   remotes/origin/HEAD   remotes/origin/master   remotes/origin/v1.0-stable   remotes/origin/experimental   remotes/win32/master   remotes/win32/new-widgets 
$ gitk --all & 
vote vote

82

git pull --all 
vote vote

75

#!/bin/bash for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do     git branch --track "${branch##*/}" "$branch" done 
git fetch --all git pull --all 
vote vote

68

git clone --mirror path/to/original path/to/dest/.git cd path/to/dest git config --bool core.bare false git checkout anybranch 
vote vote

55

git checkout somebranch 
$ git checkout somebranch Branch somebranch set up to track remote branch somebranch from origin. Switched to a new branch 'somebranch' 
$ git checkout -b <branch> --track <remote>/<branch> 

Questions similaires