本地新建分支推送后再次拉取的错误
本地新建分支推送后再次拉取的错误
本地新建一个分支后,必须要做远程分支关联。如果没有关联,git会在下面的操作中提示你显式的添加关联。关联目的是如果在本地分支下操作: git pull, git push ,不需要指定在命令行指定远程的分支.
git在本地新建分支, push到remote服务器上之后,你只要没有显示指定, git pull 的时候,就会提示你。
git push --set-upstream origin dev
等价于
<font style="color:#4D4D4D;">git push -u origin my_branch</font>
origin 是默认的远程版本库名称
在你第一次提交你的分支的时候使用。它会像<font style="color:#4D4D4D;">git branch --set-upstream</font>一样在本地分支与远程分去建立联系。
我在 Git 中创建了一个新分支:
1 | git branch my_branch |
推它:
1 | git push origin my_branch |
现在说有人在服务器上做了一些更改,我想从origin/my_branch 。我做:
1 | git pull |
但我得到:
1 | You asked me to pull without telling me which branch you |
我了解到我可以使用它:
1 | git branch --set-upstream my_branch origin/my_branch |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 褚成志的分享站!