git status message - Your branch is ahead of origin/master by X commits
git reset --hard origin/master
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 directory clean)
What does this "Your branch is ahead of 'origin/master' by X commits" message mean? I keep committing my changes with "git commit", so this message seems to be in error.
git status message - Your branch is ahead of 'origin/master' by X commits
These git "Your branch is ahead of origin/master" and "nothing to commit" messages can be misleading, especially to new git users (like myself). The thing to know here is that your branch isn't ahead of the the master -- your branch is the master.
What the git message is saying is that you're ahead of "origin/master", which (for new projects) is usually the branch on the remote git origin server. (You most likely did a "git clone" to get your git repository from the origin server.) So this message is telling you that you've made these changes, and you're now ahead of the origin server, and this message is essentially a reminder to push your changes back to the origin server.
If you're working on a simple project (like I am) you can push your changes back to the origin server with this command:
git push origin master
Git commit is not "cvs commit" or "svn commit"
Frankly, this is something I'm really struggling with regarding Git right now. I'm used to "cvs commit" or "svn commit" committing my changes back to the server, but with Git this is a multi-step step process, as shown here:
# make your changes
$ git add .
$ git commit -m 'your message'
$ git push origin master
If you forget that last step -- which I always do -- you'll see the
"Your branch is ahead of origin/master by X commits" git status message, along with the "nothing to commit" message (again, reminding you to do a "git push").
git status message - Your branch is ahead of origin/master by X commits的更多相关文章
- Your branch is ahead of 'origin/master' by 21 commits.
当切换到主分支后,准备 git pull 拉取远程 master 分支时,提示本地主分支显示有 21 个commits 问题原因: 因为你修改了 local master 本地的主分支,可以选择以下方 ...
- 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 ...
- Your branch is ahead of 'origin/master' by 2 commits.
遇到这种问题,表示在你之前已经有2个commit而没有push到远程分支上,所以需要先git push origin **将本地分支提到远程仓库.也可以直接git reset --hard HEAD~ ...
- 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 c ...
- Your branch is ahead of 'origin/master' by 1 commit.
git reset HEAD^ --soft git reset HEAD^ --hard --soft 表示保留当前commit,重新commit --hard 表示丢弃当前add,重新add.co ...
- git pull 然后 ahead of origin/master * commit 消失
本来显示 your branch is ahead origin/master * commit后来也许在master merge 这个分支后, 然后git pull, 就显示Your branch ...
- it commit提示Your branch is up-to-date with 'origin/master'.
今天提交git仓库的时候,遇到了如截图所示的问题,提示Your branch is up-to-date with 'origin/master'. 查了些资料后,发现其根本原因是版本分支的问题 这时 ...
- Git Push:error: Couldn't set refs/remotes/origin/master;error: update_ref failed for ref 'refs/remot
作者:荒原之梦 原文链接:http://zhaokaifeng.com/?p=543 今天使用Git Push代码时产生错误: Rename from 'XXXX/.git/refs/remotes/ ...
- git status: HEAD detached from origin/master问题的解决
问题:执行git status,提示: HEAD detached from origin/master 原因:分支选错了,后续的提交都提交到了一个匿名分支之上,整个状态是游离了的 解决方法: 1.查 ...
随机推荐
- Nginx简介
序言Nginx 是 lgor Sysoev 为俄罗斯访问量第二的 rambler.ru 站点设计开发的.从 2004 年发布至今,凭借开源的力量,已经接近成熟与完善.Nginx 功能丰富,可作为 HT ...
- 转:python webdriver API 之设置等待时间
有时候为了保证脚本运行的稳定性,需要脚本中添加等待时间.sleep(): 设置固定休眠时间. python 的 time 包提供了休眠方法 sleep() , 导入 time 包后就可以使用 slee ...
- configuring tortoise git and vs code.
Preparation, SSH keygen: $ git config --global user.name "calos" $ git config --global use ...
- IMapDocument interface
Provides access to members that control the reading and writing of map document files.(提供访问的成员,控制读 ...
- angular ng-href
farmApp.config([ '$compileProvider', function( $compileProvider ) { $compileProvider.aHrefSanitizati ...
- windows中的上帝模式开启方法
在任何地方创建一个新的文件夹 把文件夹命名为"GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}" 回车,ok了
- Android 带checkbox的listView 实现多选,全选,反选,删除
activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&qu ...
- Delphi中使用@取函数地址的问题(转)
Delphi中使用@取函数地址的问题 例如以下代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes ...
- 所谓完整的linux系统包括哪些部分呢?【转】
本文转载自:http://www.eeskill.com/article/index/id/1358.html 简介:三部分:bootloader.linux kernel(linux内核).root ...
- simpleBLEPeripheral.c 文件分析
这个配置或者说任务, 让这个蓝牙设备成为了一个简单的BLE外设. 这里定义了外设的广播数据, 以及最重要, char被改变之后的回调, 引出后来的coreHandler里面的, ack 以及写e2pr ...