早上在自己的一个版本代码上编辑,提交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. js空数组

    首先我们定义一个空的数组: var a = [ ]; 数组a里面是空的没有值,接下来我们打印: console.log(!!a); 因为数组是空的,此处应该为false. 恰好相反,!!a为true. ...

  2. Js高级 事件冒泡

    什么叫事件冒泡 当给父子元素的同一事件绑定方法时,触发了子元素身上的事件,执行完毕之后,也会触发父级元素的相同事件,这种传播机制叫事件冒泡. 取消事件冒泡 Event对象有个属性叫cancelBubb ...

  3. hello1源码解析

    1.选择hello1文件夹并单击“打开项目” 2.展开网页节点,双击index.xhtml文件在编辑器中查看它 index.xhtml文件是facelets应用程序的默认登录页,在典型的facelet ...

  4. javascript常见的几种事件类型

    第一种事件类型:onchange() <body> <select id="sheng" onchange="fn1();"> < ...

  5. paramiko模块(01-04节)、SSH

    1.  SSH(安全外壳协议) SSH 为 Secure Shell 的缩写,由 IETF 的网络小组(Network Working Group)所制定:SSH 为建立在应用层基础上的安全协议.SS ...

  6. 2.python发展历程

    创始人:吉多·范罗苏姆于1989年圣诞节在阿姆斯特丹编写 python分为: python 2.X python 3.X 使用python的公司: 豆瓣.BT.Dropbox.YouTube.Quor ...

  7. 【转载】Ocelot网关的路由热更新

    调用API修改Ocelot的配置文件 May 11, 2018 | netcoreocelot | 410 阅读 Ocelot是一个基于.net core的开源webapi服务网关开源项目,功能比较强 ...

  8. Dart Map<> 添加 元素

    Map<String, WidgetBuilder> routesList() { Map<String, WidgetBuilder> re = new Map<Str ...

  9. chrome's developer console

    原文链接: https://medium.freecodecamp.org/10-tips-to-maximize-your-javascript-debugging-experience-b69a7 ...

  10. Node.js express获取参数有三种方法

    express获取参数有三种方法:官网介绍如下 Checks route params (req.params), ex: /user/:id Checks query string params ( ...