博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git 提交丢失Warning, you are leaving 2 commits behind,
阅读量:4319 次
发布时间:2019-06-06

本文共 1410 字,大约阅读时间需要 4 分钟。

早上在自己的一个版本代码上编辑,提交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 信息是多重要!!!!!

 

转载于:https://www.cnblogs.com/YouXiangLiThon/p/9376674.html

你可能感兴趣的文章
c# 对加密的MP4文件进行解密
查看>>
AOP面向切面编程C#实例
查看>>
AngularJs学习笔记-慕课网AngularJS实战
查看>>
数据库三大范式
查看>>
工作总结之二:bug级别、优先级别、bug状态
查看>>
访问修饰符、封装、继承
查看>>
更换pip源到国内镜像,提升pip下载速度.
查看>>
POJ 2265 Bee Maja (找规律)
查看>>
Kendo MVVM 数据绑定(七) Invisible/Visible
查看>>
[zz]kvm环境使用libvirt创建虚拟机
查看>>
bzoj1059 [ZJOI2007]矩阵游戏
查看>>
插入返回ibatis 的selectKey 实现插入数据后获得id
查看>>
vim 程序编辑器
查看>>
LIS(单调队列优化 C++ 版)(施工ing)
查看>>
刚接触Vuex
查看>>
四种加载React数据的技术对比(Meteor 转)
查看>>
Airthmetic_Approching
查看>>
操作文本文件
查看>>
公司项目的几个问题
查看>>
解决win7下打开Excel2007,报“向程序发送命令时出现问题”的错误
查看>>