git---從已有分支拉出新分支


1:需要切換到被拉取的分支,並且拉取項目,命令如下:

1
2
3
$git checkout master 
 
$git pull

2:接着創建一個新分支,並且切換到新的分支:

1
2
3
$git branch newbranch
 
$git checkout newbranch

3:把本地分支push到遠端:

1
$git push origin newbranch

4:拉取遠端分支

1
2
3
4
5
6
7
8
9
10
11
$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> newbranch

 5:這說明,當前分支還沒有和本地分支進行關聯,下面進行關聯

  git branch --set-upstream-to=origin/newbranch

 

 6:再次拉取,完成任務。

1
$git pull


免責聲明!

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



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