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

Last-modified: 2020-06-12 (金) 18:38:42

git rm

Git管理下にあるファイルを削除するコマンド。

用例

  • ファイル「hoge.txt」が削除できるか確認する
    git rm -n hoge.txt
  • ファイル「hoge.txt」を削除
    git rm hoge.txt
  • カレントで、拡張子が「.txt」のファイル全てを削除
    git rm *.txt
  • ファイル「hoge.txt」をインデックスからのみ削除
    git rm --cached hoge.txt

書式

git rm [options] <対象ファイル>

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

git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]
       [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]
       [--] [<pathspec>…]

options

/xxxx

etc.

説明

Git管理下にあるファイルを削除するコマンド。

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

関連

参考リンク

その他メモ

なにかあれば。