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.

原文地址:https://www.cnblogs.com/ryanzheng/p/11082566.html

时间: 2024-10-04 08:58:08

Your branch is ahead of 'origin/master' by 21 commits.的相关文章

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

git status FAQ: When I issue the "git status" command, I see the following "Your branch is ahead or origin/master ..." git message: # On branch master # Your branch is ahead of 'origin/master' by 5 commits. # nothing to commit (working

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

.    commit之后,用git status,打印信息为: # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # nothing to commit (working directory clean) 说明没有文件需要commit,但是本地仓库 有一个commit ahead原来的master,就是本地仓库有一个提交,比远程仓库要先进一个commit. You get that message

idea push 时 出现如下错误 Push to origin/master was rejected

在terminl 窗口输入 D:\code\yiwei>git pull warning: no common commits remote: Counting objects: 5, done. remote: Compressing objects: 100% (3/3), done. remote: Total 5 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (5/5), done. From https://git.osch

git push origin master出错:error: failed to push some refs to

1.输入git push origin master 出错:error: failed to push some refs to 那是因为本地没有update到最新版本的项目(git上有README.md文件没下载下来) 本地直接push所以会出错. 2.所以本地要输入git pull 然后出现的英语提示'git pull <repository> <refspec>'显示要选择远程分支 2.就试试指定目标到远程分支 输入git pull origin 出现提示 but did n

更换仓库地址后,git fetch origin master报错

1.问题描述: 今天服务器迁移了下git,于是就直接根据拷贝后的git repo创建了远程仓库,本来一切都很顺利. 服务器端执行命令报错.记录下解决过程 2.执行命令报错 $ git fetch origin master @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @ @@@@@@@@@@@@@@@@@@

delete master error(git push origin :master)

All good so far. We next want to delete the branch on github. However, if we do this the naive way: git push origin :master we just get an error like this: remote: error: refusing to delete the current branch: refs/heads/master To [email protected]:m

git问题--Push rejected: Push to origin/master was rejected

解决git问题 Push rejected: Push to origin/master was rejected 意思是git拒绝合并两个不相干的东西 此时你需要在打开Git Bash,然后进入相应的目录,然后敲git命令 $ git pull origin master --allow-unrelated-histories 出现类似于这种信息就说明pull成功了: $ git pull origin master --allow-unrelated-histories From https

push to origin/master was rejected

git pull git pull origin master git pull origin master --allow-unrelated-histories git branch --set-upstream-to=origin/master master 原文地址:https://www.cnblogs.com/boazy/p/11854672.html

git push origin与git push -u origin master的区别

$ git push origin 上面命令表示,将当前分支推送到origin主机的对应分支. 如果当前分支只有一个追踪分支,那么主机名都可以省略. $ git push 如果当前分支与多个主机存在追踪关系,那么这个时候-u选项会指定一个默认主机,这样后面就可以不加任何参数使用git push. $ git push -u origin master 上面命令将本地的master分支推送到origin主机,同时指定origin为默认主机,后面就可以不加任何参数使用git push了. 不带任何参