git 提交丢失Warning, you are leaving 2 commits behind,
早上在自己的一个版本代码上编辑,提交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,的更多相关文章
- git提交时”warning: LF will be replaced by CRLF“提示
今天把项目做完之后,然后用Git准备提交代码的时候,遇到warning: LF will be replaced by CRLF警告. 当时在网上查了资料,发现很多的解决办法都是:修改git全局配置, ...
- git中找回丢失的对象
本文转载自:http://gitbook.liuhui998.com/5_9.html 译者注: 原书这里只有两个链接: Recovering Lost Commits Blog Post,Recov ...
- 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 ...
- Git提交到多个远程仓库
在已经习惯使用git同步写代码,github无疑是最的托管平台,但是国内由于"你懂的"原因,速度很慢,有时无法访问,于是想把自己的代码同步到多个不同的远程仓库备份. 我的主要仓库: ...
- git的时候 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
更改Ubuntu服务器的时候,提交git出错: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE ...
- 使用Git提交与管理代码
要成为一个合格的码农,必须要有效对自己的代码进行管理,最近打算有空就整理一下自己以前写得代码,把不涉及实验室的机密的内容等放到github上,之前只知道git clone 别人的代码,希望有一天自己的 ...
- 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 ...
- ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码
ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码: 1:问题现象: hlp@hlp:~/code/github_code/catch_imooc1$ git ...
- git提交时报错处理办法
git提交时报错:Updates were rejected because the tip of your current branch is behind: 有如下几种解决方法: 1.使用强制pu ...
随机推荐
- box-shadow做出一条线两种颜色
今天同事问我一个问题,说下图的效果是怎么实现的 我当时想都没有想说这不就是两条线嘛,他说是一条线用box-shadow做出来的,之前也没有遇到过,觉得很有意思就试了一把. 语法 box-shadow: ...
- Front-end: Using blurred backgrounds with contents unaffected.
Purpose: Using a picture as the background of a page with blurred effect, while the content not blur ...
- maven安装操作
首先检查我们的系统是否有安装JDK,检验方法:1.首先在我们的“文件资源管理器”地址栏输入cmd.在“文件资源管理器”地址栏输入cmd命令后,按下键盘上的“Enter”键,进入黑科技模式.在我们的“D ...
- 【自动化测试:笔记一】adb命令
1.查看当前连接的设备数 adb devices 2.连接设备 adb connect <设备名> 3.安装卸载app adb install packagesname adb unins ...
- Java 初始 多态
什么是多态 简单的来说就是具有多种形态的能力的特征 package ten; public interface Day1 { public void ring(); } package ten; pu ...
- node笔记汇总
项目依赖分两种,一个就是普通的项目依赖比如bootstrap,还用一种只是开发阶段需要用的,这种属于开发依赖比如gulp,开发依赖最终记录在devDependencies节点里面 - ...
- windos下安装django
一:pip install Django 安装完以后,运行python manager.py runserver 0.0.0.0:8000报错: 1):没有安装Mysql-python ...
- oracle批量删除某个用户下的所有表
打开sql developer,输入如下语句,把USERNAME替换为需要删除的的用户名 然后把查询出来的结果复制出来执行一遍就行了. SELECT 'DROP table '||table_name ...
- .net core 中间件实战
1.新建一个ASP.NET Core Web Application项目,选择空模板. 2.新建一个类RequestIPMiddleware.cs using Microsoft.AspNetCore ...
- springBoot 整合mybaits 逆向工程
pom.xml文件中增加配置项 <build> <plugins> <plugin> <groupId>org.springframework.boot ...