remote-branch

How do I check out a remote Git branch?

痴心易碎 提交于 2019-11-25 23:58:23
问题 Somebody pushed a branch called test with git push origin test to a shared repository. I can see the branch with git branch -r . Now I\'m trying to check out the remote test branch. I\'ve tried: git checkout test which does nothing git checkout origin/test gives * (no branch) . Which is confusing. How can I be on \"no branch\"? How do I check out a remote Git branch? 回答1: Update Jakub's answer actually improves on this. With Git versions ≥ 1.6.6, with only one remote, you can just do: git

How to clone all remote branches in Git?

寵の児 提交于 2019-11-25 22:01:11
问题 I have a master and a development branch, both pushed to GitHub. I\'ve clone d, pull ed, and fetch ed, but I remain unable to get anything other than the master branch back. I\'m sure I\'m missing something obvious, but I have read the manual and I\'m getting no joy at all. 回答1: First, clone a remote Git repository and cd into it: $ git clone git://example.com/myproject $ cd myproject Next, look at the local branches in your repository: $ git branch * master But there are other branches