ポイント
- 次の2つのコマンドを使用する。
 git reset --hard: ステージングと作業ディレクトリをリセットし、直前のコミット状態に一致させる。git clean -df: 追跡対象外のファイルとフォルダを削除
実践
最後のコミットから、a.txt ファイルを編集し、b/bb/b.txt フォルダ・ファイルを作成しました。
C:.
│ a.txt
│
└─b
   └─bb
         b.txt
この作業をなかったことにいたします♪
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
        modified:    a.txt
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        b/
no changes added to commit (use "git add" and/or "git commit -a")
$
$ # ステージングと作業ディレクトリをリセットし、直前のコミット状態に一致させる。
$ git reset --hard
HEAD is now at a4112cc 最初のコミット
$
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        b/
nothing added to commit but untracked files present (use "git add" to track)
$
$ # 追跡対象外のファイルとフォルダを削除
$ git clean -df
Removing b/
$
$ git status
On branch master
nothing to commit, working directory clean
$
おわりに
次のページが参考になりました♪ありがとう存じます!
以上です。
