修改 hello.rb 文件来包含一个错误的注释。

    然后去暂存它。

    1. # On branch master
    2. # Changes to be committed:
    3. # (use "git reset HEAD <file>..." to unstage)
    4. #

    status 输出显示更改已被暂存且准备提交。

    幸运的是 status 输出告诉我们取消暂存更改时需要做什么。

    1. $ git reset HEAD hello.rb
    2. Unstaged changes after reset:

    reset 命令(默认)不会更改工作目录。所以在工作目录中仍然 有不想要的注释。我们可以使用之前实验中的 checkout 命令来 从工作目录移除不想要的更改。

    1. $ git status
    2. # On branch master

    现在我们的工作目录又变干净了。