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

2,276次阅读
没有评论

共计 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协议发布,转载请注明出处。
评论(没有评论)

clark

最新文章
macos Shadowrocket与本地DNS冲突

macos Shadowrocket与本地DNS冲突

开着 Shadowrocket,本地 dns 全部失效,都走了代理,无法访问,关闭 Shadowrocket ...
openwrt Tailscale外网不通,以及部分必要设置

openwrt Tailscale外网不通,以及部分必要设置

搭建好 openwrt 之后,为了能够外网远程访问,搭配 Tailscale 可完美实现,由于首次配置,会遇到...
告别复杂配置:用Tailscale Peer Relay打造更快、更简单的内网网络

告别复杂配置:用Tailscale Peer Relay打造更快、更简单的内网网络

如果你在国内直接使用过 Tailscale,大概率会对它的连接速度有所体会。想要获得稳定可用的体验,自建 DE...

赞助广告