IT系/リファレンス/Gitコマンド/git_clean

Last-modified: 2020-06-02 (火) 01:19:33

git clean

Git管理対象外のファイルを削除するコマンド。

用例

  • カレントフォルダの削除対象ファイルを確認
    git clean -n
  • カレントフォルダの削除対象ファイルを強制的に削除
    git clean -f
  • カレントフォルダの hoge.txtファイルのみを強制的に削除
    git clean -f hoge.txt
  • カレントフォルダの削除対象ファイルで、hoge.txtファイル以外を強制的に削除
    git clean -f -e hoge.txt
  • カレントフォルダの削除対象のファイルとディレクトリを削除
    git clean -d -f
  • カレントフォルダの削除対象ファイルを強制的に削除(結果は表示しない)
    git clean -f -q
  • 削除対象ファイルを対話モードで削除
    git clean -i

書式

git clean [options]

公式によると以下の通り。

git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>…

options

/xxxx

etc.

説明

XXXX

関連

  • xxx

参考リンク

その他メモ

Git管理下にあるファイルを削除するには、git rmコマンドを使用。