git 建立分支並關聯遠程分支

從master分支,從新拉取出一個新的分支,名字爲dev,具體命令以下:git


1. 切換到被copy的分支(master),從服務器拉取最新版本服務器

$git checkout master

$git pull
 this

2. 從當前分支copy出新的開發分支 命名dev分支orm

$git checkout -b dev

Switched to a new branch 'dev'ci


3. 把新建的分支push到遠端開發

$git push origin devrem


4. 拉取遠端分支it

$git pull

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> dev

io

pull時發現,當前的分支並無和本地分支關聯,根據提示進行下一步:ast

5. 關聯

 

$git branch --set-upstream-to=origin/dev
 

6. 再次拉取 驗證

$git pull

相關文章
相關標籤/搜索