Recover a file even if it was not committed but it has to have been added when you use git reset head by mistake.
git init
echo hello >> test.txt
git add test.txt
Now the blob is created but it is referenced by the index so it will no be listed with git fsck until we reset. So we reset...
git reset --hard
git fsck
you will get a dangling blob ce013625030ba8dba906f756967f9e9ca394464a
git show ce01362
will give you the file content "hello" back
To find unreferenced commits I found a tip somewhere suggesting this.
gitk --all $(git log -g --pretty=format:%h)
I have it as a tool in git gui and it is very handy.
Recover a file even if it was not committed but it has to have been added when you use git reset head by mistake.的更多相关文章
- Recover a file when you use git reset head by mistake.
$ git init Initialized empty Git repository in .git/ $ echo "testing reset" > file1 $ g ...
- 如何理解git checkout -- file和git reset HEAD -- file
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001374831943254ee ...
- Git Stash紧急处理问题,需要切分支
在开发过程中,大家都遇到过bug,并且有些bug是需要紧急修复的. 当开发人员遇到这样的问题时,首先想到的是我新切一个分支,把它修复了,再合并到master上. 当时问题来了,你当前正在开发的分支上面 ...
- git操作笔记
首先本文参考廖雪峰的git学习教程,写的非常好,值得学习. http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b80 ...
- 深入学习:Windows下Git入门教程(上)
一,安装Git: 1.1Linux上安装命令: sudo apt-get install git 1.2在Windows上安装Git: 使用Windows版的msysgit,官方下载地址:http:/ ...
- 使用 GIT 获得Linux Kernel的代码并查看,追踪历史记录
Linux kernel 的官方 GIT地址是: http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git 可以从这个地 ...
- git研究1
error:src refspec master does not match any 将本地GIT版本库PUSH到一个GITHUB上一个空的版本库时出现错误,本地版本库为空, 空目录不能提交 (只 ...
- GitHub问题之恢复本地被删除的文件
折腾了真久,GitHub commit之后,我手痒把本地的一个文件给删了,然后一直Git pull都发现不能恢复.远程库里面还是有该文件的.就是我想将远程库的文件回到本地被删除了的位置. 特别的是,我 ...
- Git详解之六 Git工具(转)
Git 工具 现在,你已经学习了管理或者维护 Git 仓库,实现代码控制所需的大多数日常命令和工作流程.你已经完成了跟踪和提交文件的基本任务,并且发挥了暂存区和轻量级的特性分支及合并的威力. 接下来你 ...
随机推荐
- MYSQL 转换字符集的 2 种方法
方法 1. convert(expression using character_set); convert('123456789' using ascii); 方法 2. cast(expresio ...
- webpack ------require,ensure
require-ensure和require-amd的区别: require-amd 说明: 同AMD规范的require函数,使用时传递一个模块数组和回调函数,模块都被下载下来且都被执行后才执行回调 ...
- ASP.NET 短路由配置
1. 首先在项目新建文件叫App_Code或者App_Start 在文件中新建WebFromRouteHandler.cs 文件. WebFromRouteHandler中的代码如下, public ...
- Matalab之模糊KMeans实现
这节继续上节的KMeans进行介绍,上节主要是对模糊KMeans方法的原理做了介绍,没有实践印象总是不深刻,前段时间有个师姐让我帮着写了个模糊KMeans的算法,今天就拿她给出的例子来对这个方法做个实 ...
- Web常用函数介绍(LoadRunner相关)
介绍大纲:1. web_url2. web_image3. web_link4. web_submmit_form 详细介绍: 一. web_url web_url 语法: Int Web_url(c ...
- java设计模式--行为型模式--命令模式
命令模式 概述 将一个请求封装为一个对象,从而使你可用不同的请求对客户进行参数化:对请求排队或记录请求日志,以及支持可撤消的操作. 适用性 .抽象出待执行的动作以参数化某对象. .在不同的时刻指定.排 ...
- Monthly Expense(二分) 分类: 二分查找 2015-06-06 00:31 10人阅读 评论(0) 收藏
Description Farmer John is an astounding accounting wizard and has realized he might run out of mone ...
- 开发SCM系统笔记001
使用EasyUI分页问题: 1.在分页界面没有显示声明分页属性名称,系统如何获取? EasyUI会向后台发送page\rows两个参数. 2.在配置sql参数时,parametertype与param ...
- Lotto(dfs)
Lotto Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other) Total Submis ...
- js添加、删除Cookie
//cookie function addCookie(objName, objValue, objHours) { //添加cookie var str = objName + "=&qu ...