I have found a very useful command that can restore unintended deleted or modified files that have already commited:

Checkout all files

git ls-files -d |xargs -i git checkout {}
#Or
git checkout .

this command will restore that last commited version of file that have been deleted in cache.
For referring basic usage of xargs, here

Checkout single file

git checkout version -- path/to/file


Published

17 November 2013

Category

operation

Tags