0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

.gitignore が反映されないときの対処法

Last updated at Posted at 2025-03-12

概要

.gitignore
assets/
images/

など、.gitignore内でディレクトリを指定したときに、

bash
git add .gitignore
git status

などで確認しても、反映されないことがあったので解決方法を共有します。

結論

このコマンドを実行すると出来ます。

bash
git rm -r --cached {pass}

解説

なんらかの理由でGitがディレクトリの追跡(track)をしてしまっている可能性があるので、
Gitのキャッシュから指定ディレクトリを削除し、追跡を解除することで解決できます。

確認

キャッシュを削除したら、再度確認してみましょう。

bash
git add .gitignore
git status

.gitignoreで指定したディレクトリが表示されてなかったら成功です。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?