0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

.gitignoreで除外できないとき

Posted at

開発途中でGit管理から除外したいファイルがでてきたのですが、ちょっと戸惑ったのでメモ

認識

ワークツリー => インデックス(ステージング) => ローカルリポジトリ => リモートリポジトリ
.gitignore に記載された対象ファイルは、git add の実行時に、インデックスに追加されない

=>まだ追跡されていなければ、git add の実行時に追跡から除外できる

=>すでに追跡されていれば、インデックスから削除してから

解決方法

# インデックスからファイルを削除
$ git rm --cached <FILE_NAME>

# インデックスからディレクトリごと削除
$ git rm --cached -r ディレクトリ名
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?