Git 忽略文件的修改
通过 git diff 查看到已修改了 a.php 和 b.php 两个文件。想要恢复 a.php 文件为初始内容,而 b.php 文件不理会。
$ git diff
modified: a.php
modified: b.php
$ git checkout -- a.php
$ git diff
modified: b.php
或使用下述命令,恢复到指定版本的 a.php
git checkout HEAD -- a.php
# 或
git checkout <COMMIT-ID> -- a.php