LoginSignup
12
13

More than 5 years have passed since last update.

トラッキングされていない大量のゴミファイルをまとめて削除する - clean

Posted at

めったに使わないわりに覚えてないと超面倒なのでメモ。
例えばこういう状態のときに、gomi連中を全部まとめて削除するgitコマンド。

$ git status
## branch
?? gomi.file
?? gomidir/gomi1.file
?? gomidir/gomi2.file
?? gomidir/gomi3.file
?? gomikuzu1.file
?? gomikuzu2.file
# 以下ずらーっといらないファイルが延々と

正解はコレ。

$ git clean -n #dry-runで確認
$ git clean -f #削除実行

ディレクトリも再起的に削除したい場合は更に-dオプションを追加。

$ git clean -dn #dry-runで確認
$ git clean -df #削除実行

参考:git help clean

12
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13