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


從master分支,重新拉取出一個新的分支,名字為dev,具體命令如下:


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

$git checkout master

$git pull
 

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

$git checkout -b dev

Switched to a new branch 'dev'


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

$git push origin dev


4. 拉取遠端分支

$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

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

5. 關聯

 

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

6. 再次拉取 驗證

$git pull


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM