2014-01-15 174 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>