LoginSignup
4
2

More than 3 years have passed since last update.

【Git】Untracked filesをまとめて削除する方法

Posted at

プログラミング勉強日記

2021年3月21日

エラーの内容

 git checkout .したのだが、まだ不要なファイル(未追跡ファイル)が残ってしまっていて以下のようになる。

image.png

$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        path...
        path...
nothing added to commit but untracked files present (use "git add" to track)

削除するファイルを確認して削除する

 事前にどのファイルが削除されるか確認してから、削除するときはいかのコマンドを使う。

$ git clean -dfn

 それぞれのコマンドオプションの意味↓

-d:ディレクトリも含めて削除する
-f:強制的に削除する
-n:確認を行う

参考文献

git cleanでUntracked files(未追跡ファイル)をまとめて削除したい時

4
2
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
4
2