命令
git ls-files -d | xargs echo -e | xargs git checkout --
恢复删除的所有文件(文件目录中含有中文)
解析
git ls-files -d
打印出被删除所有文件 (中文会被显示为转义字符) ,如最下面的代码段
xargs echo -e
将输出中转义中文显示为正常的中文
xargs git checkout --
将对应的文件恢复
admin@admin-PC ~/Documents/GitHub/wenfengshi.github.io/_posts (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: "\346\212\200\346\234\257/2016-09-09-CNA_FCoE_RDMA_Chelsio.md"
deleted: "\346\212\200\346\234\257/2016-09-09-gridftp_installation.md"
deleted: "\346\212\200\346\234\257/2016-09-09-sdn_cbench.md"
deleted: "\346\212\200\346\234\257/2016-09-09-sdn_controller_test.md"
deleted: "\346\212\200\346\234\257/2016-09-09-sdn_security_papers.md"
deleted: "\346\212\200\346\234\257/2016-09-09-wireshark_sdn_parse.md"
modified: "\346\212\200\346\234\257/2016-09-21-performance_tools.md"
admin@admin-PC ~/Documents/GitHub/wenfengshi.github.io/_posts (master)
$ git ls-files -d | xargs echo -e
技术/2016-09-09-CNA_FCoE_RDMA_Chelsio.md 技术/2016-09-09-gridftp_installation.md 技术/2016-09-0_cbench.md 技术/2016-09-09-sdn_controller_test.md 技术/2016-09-09-sdn_security_papers.md 技术/29-09-wireshark_sdn_parse.md