早上在自己的一个版本代码上编辑,提交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. 《Java编程思想》读书笔记-对象导论

    计算机是头脑延伸的工具,是一种不同类型的表达媒体.本文以背景性的和补充性的材料,介绍包括开发方法概述在内的面向对象程序设计(Object-oriented Programming,OOP)的基本概念. ...

  2. latex之注释快捷键

    注释快捷键 ctrl+T:注释掉选中区域 ctrl_U:解除选中区域的注释

  3. jmeter4.0安装记录

    前提:jmeter需配置环境变量jdk,jmeter4.0版本需1.7以上版本, 查看jdk版本命令java -version 1.官网http://jmeter.apache.org/downloa ...

  4. python 使用gevent模块实现手动挡切换多协程。

    from greenlet import greenlet def test1(): print(12) g2.switch()#切换到协程g2执行,保存执行状态 print(23) g2.switc ...

  5. 《Linux内核原理与分析》第八周作业

    课本:第七章 可执行程序工作原理 ELF目标文件格式 目标文件:编译器生成的文件. 目标文件的格式:out格式.COFF格式.PE(windows)格式.ELF(Linux)格式. ELF(Execu ...

  6. $\mathcal{OI}$生涯中的各种数论算法的证明

    嗯,写这个是因为我太弱了\(ORZ\). #\(\mathcal{\color{silver}{1 \ \ Linear \ \ Sieve \ \ Method \ \ of \ \ Prime}} ...

  7. maven安装操作

    首先检查我们的系统是否有安装JDK,检验方法:1.首先在我们的“文件资源管理器”地址栏输入cmd.在“文件资源管理器”地址栏输入cmd命令后,按下键盘上的“Enter”键,进入黑科技模式.在我们的“D ...

  8. 【python接口自动化-requests库】【三】优化重构requests方法

    一.重构post请求方法 上一张讲了如何使用requests库发送post请求,但是有时候,我们写脚本,不可能这么简单,代码完全不可复用,重复工作,那我们是不是可以想象,把我们的get,post请求, ...

  9. 【HDU5187】contest

    真的没有什么会写的东西了QAQ 原题: As one of the most powerful brushes, zhx is required to give his juniors n probl ...

  10. OpenLDAP主从

    yum -y install compat-openldap必须得安装这个   1:在主上       备份         cp /etc/openldap/slapd.conf /etc/open ...