開發過程當中常常用到從master分支copy一個開發分支,下面咱們就用命令行完成這個操做:git
1. 切換到被copy的分支(master),而且從遠端拉取最新版本this
$git checkout master命令行
$git pullorm
2. 從當前分支拉copy開發分支ci
$git checkout -b dev開發
Switched to a new branch 'dev'rem
3. 把新建的分支push到遠端
$git push origin devit
4. 拉取遠端分支
$git pullio
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.ast
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> dev
通過驗證,當前的分支並無和本地分支關聯,根據提示進行下一步:
5. 關聯
$git branch --set-upstream-to=origin/dev
6. 再次拉取 驗證
$git pull