Git说,从远程站点撤出后,本地分支已经远程遥遥领先 [英] Git says local branch is ahead of remote after having pulled from remote

查看:230
本文介绍了Git说,从远程站点撤出后,本地分支已经远程遥遥领先的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很抱歉如果标题不清楚,但这是一个奇怪的问题。

git checkout 到我的stage分支,然后 git pull 来获取我的合作伙伴的最新更改(他昨晚推送到远程存储库上的stage分支),果然,他们合并到我的本地舞台分支。 git log< branch> 显示了他昨晚进行的五次提交。

然后我切换到主分支把它从回购中拉出来,因为他告诉我他在测试之后将这些更改合并到主分支。但是当我 git checkout stage 回到我的stage分支时,它说我远远超过了5次提交的远程分支。我 git log origin / stage 并且它没有显示我刚刚从该存储库(此项目中唯一的远程存储库)提取的五个提交。 git log stage 显示了我在本地舞台分支上的五个提交,所以我很遗憾远程分支在服务完后可能马上回来我的合作伙伴的最新提交。



我很新,所以我会感谢你对我的耐心,因为我仍然在努力掌握DCVS,并且有一个很好的机会,我只是误解了一些非常基本的东西。

解决方案

试试这个命令:

  git log origin / stage..stage 

这显示你在遥控器上的位置。根据需要执行 git rebase origin / stage / git push

如果没有帮助,请参阅以下问题:'git pull origin mybranch'离开本地mybranch N提前提交。为什么?


I’m sorry if the title isn’t clear, but this is a weird problem.

I git checkout to my "stage" branch and git pull to get my partner’s latest changes (which he pushed last night to the "stage" branch on the remote repository), and sure enough, they merge to my local "stage" branch. git log <branch> shows five commits he performed last night.

I then switch over to the master branch to pull that from the repo because he told me he merged those changes to the master branch after testing them. But when I git checkout stage to get back to my "stage" branch it says I’m ahead of the remote branch by 5 commits. I git log origin/stage and it shows none of the five commits I just pulled from that repository (the only remote repository on this project). git log stage shows the five commits on my local "stage" branch, so I’m at a loss at how the remote branch could have gone back in time immediately after serving me my partner’s latest commits.

I’m pretty new at this, so I’ll appreciate your patience with me, as I’m still trying to grasp DCVSs and there’s a good chance I’m simply misunderstanding something really basic.

解决方案

Try this command:

git log origin/stage..stage

This show you what you are ahead of the remote. Do a git rebase origin/stage / git push as appropriate.

If it doesn't help, see this question : 'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?

这篇关于Git说,从远程站点撤出后,本地分支已经远程遥遥领先的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆