Git:分支在X提交之前。没有帮助做混帐拉 [英] Git: Branch is ahead by X commits. Doesn't help doing git pull

查看:106
本文介绍了Git:分支在X提交之前。没有帮助做混帐拉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到其他类似的问题,但我不明白为什么会发生这种情况。现在,我使用 git reset --hard HEAD 然后手动添加回我的更改。建议的解决方案似乎是 git pull origin master ?但之后我仍然收到相同的信息。怎么了?我如何做一个合并?我还是比较新的GIT

  $ git pull origin master 
Nodester!
输入密钥'/home/jiewmeng/.ssh/id_rsa'的密码:
来自nodester.com:/node/git/jiewmeng/10267-f62c0a21d1a9d75ab7b6ace5858921d0
*分支主机 - > FETCH_HEAD
通过'递归'策略进行合并。

$ git branch -a
* master
遥控器/原点/主控制器


解决方案

正如


您的分支在...之前=> 您需要推送至远程master
运行 git diff origin / master 来查看本地存储库和远程主存储库之间的区别。


如果您通过一次提交超出远程回购,则远程回购已过期,而不是您。 >
拉不起。



现在检查你是否真的在一个分支上(而不是在分离的头上)。

这里是你的情况(你确实是这样在 master 分支上)


I do see other similar questions, but I dont really understand why this happens. For now, I am using git reset --hard HEAD then manually adding back my changes. The suggested solution seems to be git pull origin master? But I still get the same message after that. Whats wrong? How do I do a merge? I am still relatively new to GIT

$ git pull origin master
Nodester!
Enter passphrase for key '/home/jiewmeng/.ssh/id_rsa': 
From nodester.com:/node/git/jiewmeng/10267-f62c0a21d1a9d75ab7b6ace5858921d0
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.

$ git branch -a
* master
  remotes/origin/master

解决方案

As mentioned in "Why is Git telling me "Your branch is ahead of 'origin/master' by 11 commits." and how do I get it to stop?"

"your branch is ahead by..." => You need to push to the remote master.
Run "git diff origin/master" to see what the differences are between your local repository and the remote master repository.

If you're ahead of the remote repo by one commit, it's the remote repo that's out of date, not you.
Pulling wouldn't help.

Now check also if you are actually on a branch (and not on a detached head).
This is your case here (you are indeed on master branch)

这篇关于Git:分支在X提交之前。没有帮助做混帐拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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