Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git 如何 clone 非 master 分支的代码? #5

Open
zhuangyin8 opened this issue Oct 4, 2017 · 0 comments
Open

Git 如何 clone 非 master 分支的代码? #5

zhuangyin8 opened this issue Oct 4, 2017 · 0 comments

Comments

@zhuangyin8
Copy link
Owner

zhuangyin8 commented Oct 4, 2017

我们每次使用命令git clone https://github.com/marijnh/Eloquent-JavaScript.git或者通过Webstorm
git clone 默认会把远程仓库整个给clone下来,但只会在本地默认创建一个master分支。如果最新的代码版本或者我们需要的代码版本不在 master 分支上,该如何获取非 master 分支的代码?

git-branch-e730b9fd

解决方法

如果代码已经 clone 到本地,那么直接在本地代码文件夹路径下使用命令

git branch -r #查看远程分支

git branch -a #查看所有分支

git-branch-8f12d76f

成功切换到3rd分支

@zhuangyin8 zhuangyin8 changed the title Git 如何 clone 非 master 分支的代码 Git 如何 clone 非 master 分支的代码? Oct 4, 2017
@zhuangyin8 zhuangyin8 self-assigned this Dec 20, 2017
@zhuangyin8 zhuangyin8 reopened this Dec 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant