早上在自己的一个版本代码上编辑,提交commint,但是checkout到其他分支再checkout回来发现该的东西不见了,

幸好terminal还没有关掉,回看日志:

Warning: you are leaving 2 commits behind, not connected to
any of your branches:

****** update
  ****** 增加flask中间服务文件

If you want to keep them by creating a new branch, this may be a good time
to do so with:

git branch <new-branch-name>   ******

然后就将刚刚修改的创建新分支就好,

git branch <new-branch-name>   ******

但是,如果当时终端关闭了或者其他原因没有找到呢?

其实,只要你commint了,git本地是保存了这个变化的,就是没有一个分支链接到这种变化,可以使用:

git reflog show HEAD@{now} -10
****** HEAD@{Fri Jul 27 11:24:56 2018 +0800}: checkout: moving from ******
****** HEAD@{Fri Jul 27 11:19:43 2018 +0800}: checkout: moving from master to 1a
****** HEAD@{Fri Jul 27 11:17:55 2018 +0800}: checkout: moving from develope to master
****** HEAD@{Fri Jul 27 11:17:40 2018 +0800}: checkout: moving from****** to develope
****** HEAD@{Fri Jul 27 11:16:16 2018 +0800}: checkout: moving from master to 1a
****** HEAD@{Fri Jul 27 11:15:50 2018 +0800}: checkout: moving from****** to master
****** HEAD@{Fri Jul 27 11:12:54 2018 +0800}: commit: update
****** HEAD@{Fri Jul 27 10:36:07 2018 +0800}: commit: 增加flask中间服务文件
****** HEAD@{Thu Jul 26 16:34:14 2018 +0800}: checkout: moving from develope to 1a
****** HEAD@{Thu Jul 26 16:34:09 2018 +0800}: commit: update hello.py

然后跟据当时的commit信息找到编号,再

git branch <new-branch-name>   ******

可见,认真写好每个commint 信息是多重要!!!!!

git 提交丢失Warning, you are leaving 2 commits behind,的更多相关文章

  1. git提交时”warning: LF will be replaced by CRLF“提示

    今天把项目做完之后,然后用Git准备提交代码的时候,遇到warning: LF will be replaced by CRLF警告. 当时在网上查了资料,发现很多的解决办法都是:修改git全局配置, ...

  2. git中找回丢失的对象

    本文转载自:http://gitbook.liuhui998.com/5_9.html 译者注: 原书这里只有两个链接: Recovering Lost Commits Blog Post,Recov ...

  3. Git提交引用和引用日志

    转载自:https://github.com/geeeeeeeeek/git-recipes/wiki/5.5-Git%E6%8F%90%E4%BA%A4%E5%BC%95%E7%94%A8%E5%9 ...

  4. Git提交到多个远程仓库

    在已经习惯使用git同步写代码,github无疑是最的托管平台,但是国内由于"你懂的"原因,速度很慢,有时无法访问,于是想把自己的代码同步到多个不同的远程仓库备份. 我的主要仓库: ...

  5. git的时候 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

    更改Ubuntu服务器的时候,提交git出错: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE ...

  6. 使用Git提交与管理代码

    要成为一个合格的码农,必须要有效对自己的代码进行管理,最近打算有空就整理一下自己以前写得代码,把不涉及实验室的机密的内容等放到github上,之前只知道git clone 别人的代码,希望有一天自己的 ...

  7. Git提交时提示‘The file will have its original line endings in your working directory’

    Git提交时提示'The file will have its original line endings in your working directory' Git出现错误 git add -A ...

  8. ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码

    ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码: 1:问题现象: hlp@hlp:~/code/github_code/catch_imooc1$ git ...

  9. git提交时报错处理办法

    git提交时报错:Updates were rejected because the tip of your current branch is behind: 有如下几种解决方法: 1.使用强制pu ...

随机推荐

  1. Oracle 导出的表不全,以及数据库版本不同导入报错

    公司有两个环境下的数据库,版本不同,一个是11g r2,另一个是10g r2 首先在11g r2下用exp导出数据库备份文件,发现部分表缺失. 原来这部分表是空的,11G中新特性,当表无数据时,不分配 ...

  2. Git 简介及简单操作

    一.GIT是什么 Git 是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本 ...

  3. mod_conference ESL控制三(程序)

    第一篇描述了mod_conference控制原理,第二篇描述了conference相关事件,接下来对esl内联程序做简要说明. 由于event-socket采用TCP协议,因此需要一个线程与frees ...

  4. 2018年3月6日16:54:58 考试错误的java题目总结

  5. Ubuntu下math库函数编译时未定义问题的解决

    自己在Ubuntu下练习C程序时,用到了库函数math.h,虽然在源程序中已添加头文件“math.h”,但仍提示所用函数未定义,原本以为是程序出错了,找了好久,这是怎么回事呢? 后来上网查了下,发现是 ...

  6. cordova热更新插件的使用:cordova-hot-code-push-plugin

    1. 添加插件:cordova plugin add cordova-hot-code-push-plugin 2. 先打开cli,执行命令 npm install -g cordova-hot-co ...

  7. mysql 启动失败,数据恢复

    mysql 启动失败,数据恢复 2017年02月13日 16:46:36 阅读数:621 Forcing InnoDB Recovery提供了6个等级的修复模式,需要注意的是值大于3的时候,会对数据文 ...

  8. 阿里云centos5升级yum源为6

    升级后出现Errno -3] Error performing checksum 需要安装 python-hashlib Python 2.4 安装 hashlib 2012年11月13日 14:29 ...

  9. ado.net调用带参数的sql语句

  10. Backbone 学习总结

    1.Backbone描述 官网描述:(1)Provides client-side app structure (2)Models to repents data (3)View to hook up ...