2014-01-15 52 views
0

下面是给出了最新的DIFFgit:如何恢复已被删除的文件?

diff --git a/app/config/parameters.yml b/app/config/parameters.yml 
deleted file mode 100755 
index [not important] 
--- a/app/config/parameters.yml 
+++ /dev/null 

带有注释与正在添加它:git log

commit [not important] 
Author: <not important> 
Date: [not important] 

    Never commit the parameters.yml 

现在混帐删除了此文件,它打破了整个网站。如何恢复它?

这是不是一个重复的,因为如果我这样做:

>git checkout [rev number not ipmortant] -- app/config/parameters.yml 
error: pathspec 'app/config/parameters.yml' did not match any file(s) known to git. 

那么如何产生它在历史

回答

1

如果变化将提交:

git checkout <commit hash> <filename> 

如果变更未提交,请参阅answer of WeGi

也考虑恢复使用git-revert删除文件的提交的可能性,例如,

git revert <commit hash>