建立本地分支并送出到遠端
- 1. git branch -r 指令檢視遠端庫的分支情況(其他分支就不列出來了)
- 2.從已有的分支建立新的分支(如從develop分支),建立一個newneeds_0215分支
- 3.我們git branch -a檢視一下目前分支,發現已經切換過來了
- 4.我們通過git push試圖将本地分支推到遠端,發現出現以下報錯:
fatal: The current branch feature/newneeds_0215 has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin feature/newneeds_0215
問題的原因是沒有将本地的分支與遠端倉庫的分支進行關聯,遠端有許多分支,不知道你到底想推到那個分支上去
-
5.我們輸入git push --set-upstream origin feature/newneeds_0215
本地分支推到遠端newneeds_0215分支上了,這時候我再git branch -r就可以看見遠端newneeds_0215分支了