Skip to content

Instantly share code, notes, and snippets.

@ThinkZ
Created August 28, 2017 08:00
Show Gist options
  • Save ThinkZ/26a5b51dadb3d95d5f32af5f09ca4771 to your computer and use it in GitHub Desktop.
Save ThinkZ/26a5b51dadb3d95d5f32af5f09ca4771 to your computer and use it in GitHub Desktop.
git clone 所有远程分支
git clone 所有远程分支
git clone只能clone远程库的master分支,无法clone所有分支,解决办法如下:
1. 找一个干净目录,假设是git_work
2. cd git_work
3. git clone http://github.xxx.com/project/.git ,这样在git_work目录下得到一个project子目录
4. cd project
5. git branch -a,列出所有分支名称如下:
remotes
/origin/devremotes
/origin/release
6. git checkout -b dev origin/dev,作用是checkout远程的dev分支,在本地起名为dev分支,并切换到本地的dev分支
7. git checkout dev,切换回dev分支,并开始开发。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment