git branch --set-upstream-to 本地關聯遠程分支


最近使用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> release

其實,輸出的提示信息說的還是比較明白的。

使用git在本地新建一個分支后,需要做遠程分支關聯。如果沒有關聯,git會在下面的操作中提示你顯示的添加關聯。

關聯目的是在執行git pull, git push操作時就不需要指定對應的遠程分支,你只要沒有顯示指定,git pull的時候,就會提示你。

解決方法就是按照提示添加一下唄:

git branch --set-upstream-to=origin/remote_branch  your_branch

其中,origin/remote_branch是你本地分支對應的遠程分支;your_branch是你當前的本地分支。


免責聲明!

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



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