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 because you made changes
in your local master and you didn’t push them to remote. You have several ways
to “solve” it and it normally depends on how your workflow looks like:

  • If you work in another
    way and your local changes should be pushed then just

git push origin

  • 1

assuming origin is your remote

  • If your local changes
    are bad then just remove them or reset your local master to the state on remote

git reset --hard origin/master

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

原文地址:https://www.cnblogs.com/hilaryqs/p/9212576.html

时间: 2024-10-05 22:04:18

Git报错:Your branch is ahead of 'origin/master' by 1 commit的相关文章

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

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/q

IDEA上传Git项目报错:Push rejected: Push to origin/master

错误信息: Push rejected: Push to origin/master was rejected 解决办法: 1.选择你要上传代码的文件夹,鼠标右键git Bash Here 2.输入下面两行命令 git pull origin master –allow-unrelated-histories --把远程仓库中的内容 pull 到本地工作目录git push -u origin master -f --在 pull 下来的项目中做修改,通过以上命令 push 到远程仓库了 原文地

eclipse git 报错:the current branch is not configured for pull No value for key branch.xxx.merge found

eclipse git 报错:the current branch is not configured for pull No value for key branch.xxx.merge found in configuration 如图: 这是因为 在用gui创建分支的时候 config文件没有创建branch 在config文件加上 [branch "xxx"] remote = origin merge = refs/heads/xxx 即可 eclipse git 报错:th

git报错:'fatal:remote origin already exists'怎么处理?附上git常用操作以及说明。

git添加远程库的时候有可能出现如下的错误, 怎么解决? 只要两步: 1.先删除 $ git remote rm origin 2.再次执行添加就可以了. ----------------------------------------------git常用操作------------------------------------------------ 说明,以下整理来自廖雪峰大神的<git教程>. 各位童鞋要下载git但是网速不给力的,可以从这里下载:https://pan.baidu.

git报错:&#39;fatal:remote origin already exists

git报错:'fatal:remote origin already exists'怎么处理?附上git常用操作以及说明. git添加远程库的时候有可能出现如下的错误, 怎么解决? 只要两步: 1.先删除 1 $ git remote rm origin 2.再次执行添加就可以了. ----------------------------------------------git常用操作------------------------------------------------ 说明,以下整

解决更新Xcode以后使用Git报错的问题

更新Xcode以后使用Git报错: [email protected] SecondApp$ git pull Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. 解决办法: 第一步: 输入下面的命令 bixiaopeng@bixiaopengtekiMacBook-Pro SecondApp$ sudo xcodebuild -license Password:

git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).

Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 解决办法一:保留本地的更改,中止合并->重新合并->重新拉取 $:git merge --abort $:git reset --merge $:git pull 解决办法二:舍弃本地代码,远端版本覆盖本地版本(慎重) $:git fetch --all $:git reset --hard origin/ma

git报错failed to push some refs to &#39;[email&#160;protected]:Markprint/github.git&#39;

 这个不知名小错误用了我两天的空余时间mmp   就是这里报的错 输入 git push origin master -f 解释为: 远程分支上存在本地分支中不存在的提交,往往是多人协作开发过程中遇到的问题,可以先fetch再merge,也就是pull,把远程分支上的提交合并到本地分支之后再push.如果你确定远程分支上那些提交都不需要了,那么直接git push origin master -f,强行让本地分支覆盖远程分支 终于有了,以后还需要具体研究一下 虽然用的github,但是要推广一下