There is no tracking information for the current branch. Please specify which branch you want to...

git合并代码出现的状况

合并完代码并上传远程分支时发现出现以下报错
在这里插入图片描述
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details
大致意思是:当前分支落后,先使用git pull下拉代码。
可能出现的原因是,有人上传代码的时候,把代码提交到主分支上,而你在合并代码的时候,又没有先使用git pull更新你主分支,直接合并代码,等提交才发现出错了。

当出错以后用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> dev

大致意思是:你要指定pull那个分支的
所以你要用git pull origin 分支

git pull以后可能出现下面的情况

git pull以后,你在提交到远程分支可能会有下面图片的提示:
在这里插入图片描述
这个意思就是说,你要编辑一下合并的必要性。
可以不用写内容
只用执行以下步骤即可解决问题
第一步: 点击i
第二步: 点击Esc
第三步:输入:wq
第四步:点击Enter
即可完成

最后再次提交到主分支即可解决本问题

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值