2010年8月13日星期五

Git saved my day - restore accidentally deleted files using Git version control

Today I somehow accidentally deleted some source code files in Intellij IDEA. I don't know how this exactly happened - I must have clicked the wrong menu item.

Because I'm using Git for version control I could recover the files immediately (see below).

To show deleted files use the command:

"git ls-files -d"

To restore the deleted files use:

"git ls-files -d | xargs git checkout --"

(without the quotation marks of course).

The source for this information can be found here:

http://lists.freedesktop.org/archives/xorg/2006-October/018572.html

So, thanks Git!

1 条评论:

  1. 嘿嘿,路过啦,很喜欢博主的博客。 Crazy1in.tk 留下脚印

    回复删除