- git checkout master
- git pull
-
git checkout -b dev
这里新建分支dev,并直接切换到该分支上。
-
git push origin dev:dev
将本地分支dev push 到远程,并切远程的分支也叫dev。
-
git branch --set-upstream-to=origin/dev(这步是:关联)
这个步骤很关键,要指定本地的分支dev与远程的哪个分支进行关联,如果没有这个步骤,我们会经常遇到下面的提示信息:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> release