git branch - How to clone all remote branches in Git? -
i have master , development branch, both pushed github. i've cloned, pulled, , fetched, remain unable other master branch back.
i'm sure i'm missing obvious, have read manual , i'm getting no joy @ all.
first, clone remote git repository , cd it:
$ git clone git://example.com/myproject $ cd myproject next, @ local branches in repository:
$ git branch * master but there other branches hiding in repository! can see these using -a flag:
$ git branch -a * master remotes/origin/head remotes/origin/master remotes/origin/v1.0-stable remotes/origin/experimental if want take quick peek @ upstream branch, can check out directly:
$ git checkout origin/experimental but if want work on branch, you'll need create local tracking branch done automatically by:
$ git checkout experimental and see
branch experimental set track remote branch experimental origin. switched new branch 'experimental' that last line throws people: "new branch" - huh? means branch taken index , created locally you. previous line more informative tells branch being set track remote branch, means origin/branch_name branch
now, if @ local branches, you'll see:
$ git branch * experimental master you can track more 1 remote repository using git remote.
$ 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 at point, things getting pretty crazy, run gitk see what's going on:
$ gitk --all &
Comments
Post a Comment