Git: Branch is ahead by X commits. Doesn't help doing git pull

后端 未结 4 1753
无人及你
无人及你 2021-01-03 03:16

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.

4条回答
  •  臣服心动
    2021-01-03 03:28

    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)

提交回复
热议问题