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

Posted ryanzheng

tags:

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

当切换到主分支后,准备 git pull 拉取远程 master 分支时,提示本地主分支显示有 21 个commits

技术图片

 

问题原因:

因为你修改了 local master 本地的主分支,可以选择以下方法之一:

保持本地 master 的内容,使用 git push origin,将本地的修改直接提交到远程

或者删除本地分支所有修改,同步远程 master 到本地,使用 git reset --hard origin/master

 

参考链接:

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

 

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

git status message - Your branch is ahead of origin/master by X commits

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

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

VS2019 github push失败: Updates were rejected because the tip of your current branch is behind

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

New York is 3 hours ahead of California