GIT本地分支与远程分支:set-upstream-to

1,336次阅读
没有评论

共计 686 个字符,预计需要花费 2 分钟才能阅读完成。

有时创建 git 项目时候,经常会见到下方报错信息:

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 push
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push origin HEAD:dev

To push to the branch of the same name on the remote, use

    git push origin HEAD

To choose either option permanently, see push.default in 'git help config'.

解决办法

通常出现上述问题,都是因为本地和远程分支关联关系不正确导致的,解决办法也很简单,使用关联命令,指定本地和远程分支绑定即可:

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

将本地 dev 分支关联到远程 master 分支。

正文完
加入官方交流QQ群:778957856
post-qrcode
 0
clark
版权声明:本站原创文章,由 clark 于2022-11-23发表,共计686字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)