git add
を無かったことにします。
コマンド
$ git reset foo.txt
実行例
git reset [ファイルのパス]
でキャンセルすることができます。
$ git add foo.txt $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: foo.txt
git reset
するとUntracked fileとなり、git add
する前の状態に戻りました。
$ git reset foo.txt $ git status On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) foo.txt
なお、git reset [ファイルのパス]
は git reset HEAD [ファイルのパス]
と同じ意味になります。