Recover a file even if it was not committed but it has to have been added when you use git reset head by mistake.
2014-04-17 20:30
716 查看
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 when you use git reset head by mistake.
- 使用cocapods报错 [!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes
- The web application registered the JDBC driver * but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
- how to solve the problem when you have chmod the directory to 777 but the apache still can not write file
- 奇葩问题:This file could not be checked in because the original version of the file on the server was moved or deleted. A new version of this file has been saved to the server, but your check-in comments were not saved
- The source file is different from when the module was built. Would you like the debugger to use it anyway?
- It seems that this file has not been built yet.Do you want to build it now? Codeblocks能构建build不能运run
- It seems that this file has not been built yet.Do you want to build it now? Codeblocks能构建build不能运run
- The source file is different from when the module was built. Would you like the debugger to use it anyway?
- It seems that this file has not been built yet.Do you want to build it now? Codeblocks能构建build不能运ru
- registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
- 在使用jar时,eclipse提示has to have a jad file file if it exports a mildlet jar
- VC6编辑时提示This file has been modified outside of the source of editor.Do you want to reload it?解决方法
- xxx couldn't be loaded because it has not been added to the build settings.
- SecureCRT ssh连接虚拟机后显示 A public key file has not been specified for this session,Would you like to...
- The CPU has been disabled by the guest operating system. You will need to power off or reset the vir
- cocoapods was not able to update the 'master' repo.if it is a unexpected issue and persists you can
- Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextE
- The object of type 'RectTransform' has been destroyed but you are still trying to access it
- Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextE