Git Your branch is ahead of 'origin/master' by X commits解决方法

Posted zndxall

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git Your branch is ahead of 'origin/master' by X commits解决方法相关的知识,希望对你有一定的参考价值。

 

(1)方法1:git fetch origin

(2)方法2(代码还需要):git push origin

(3)方法3 (代码不需要):git reset --hard origin/$branch

  参考:

  https://blog.csdn.net/Thousa_Ho/article/details/73350703

  https://stackoverflow.com/questions/16288176/your-branch-is-ahead-of-origin-master-by-3-commits

  可以先执行下git  diff $branch origin/$branch 看下差异

(4) git pull --rebase

(5)git pull origin cherryPick

  参考:https://blog.csdn.net/u010383937/article/details/72901675

 

以上是关于Git Your branch is ahead of 'origin/master' by X commits解决方法的主要内容,如果未能解决你的问题,请参考以下文章

Git报错:Your branch is ahead of 'origin/master' by 1 commit

Your branch is ahead of 'origin/master' by 21 commits.

git提交时报错:Updates were rejected because the tip of your current branch is behind

Git 用git status命令时,不提示Your branch is up-to-date with 'origin/master'.信息,请问如何解决?

git报错:Your branch and ‘origin/master‘ have diverged

Updates were rejected because the tip of your current branch is behind