ファイルを変更したり、追加したりしたけど、やっぱりHEADの状態まで戻したいという場合
1 2 3 4 | git reset --hard # removes staged and working directory changes git clean -f -d # remove untracked files git clean -f -x -d # CAUTION: as above but removes ignored files like config. |
参考: git: undo all working dir changes including new files
参考: git cleanのオプション
1 2 3 4 5 6 7 8 9 10 11 | usage: git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>... -q, --quiet do not print names of files removed -n, --dry-run dry run -f, --force force -i, --interactive interactive cleaning -d remove whole directories -e, --exclude <pattern> add <pattern> to ignore rules -x remove ignored files, too -X remove only ignored files |