自分用のメモ書きです
間違っている等ありましたらコメントください!!
ことの発端として、、、
デザイナーさん「git add style.ccs
できない...」
ということがありました。
☆対応方法
まず、プロジェクトのトップにある.gitignore
を確認
→同じファイル名や拡張子がないか確認しましょう。
→ない場合は下の解決策を試してみて下さい!
.DS_Store
が悪さしている
Mac用に.DS_Store
を.gitignore
に記述してあることがあります。
解決策
.gitignore
から.DS_Store
を削除
↓
追加できなかったファイルがGitに認識されているか確認し
git add 対象ファイル
↓
.gitignore
に.DS_Store
を追記
設定かキャッシュが残っている
一度Git管理下にしたファイルは、.gitignore
や.git/info/exclude
に管理を無視する設定があっても適用されません。
そういう場合にGitに追加の設定として、"assume-unchanged"としてあえて無視させている場合があります。
これが、ステージングできない理由の1つです。
解決策
ターミナルで、プロジェクトのTOPから下記コマンドを入力
$ git update-index --no-assume-unchanged ファイルパス
上記コマンドで認識されない場合
→キャッシュを削除し、最後のコミットからGitインデックスを再ロードさせます。
※"Stack Overflow"の直訳なので間違っていたらすみません。
$ git rm --cached ファイルパス
$ git reset ファイルパス
☆参考文献
https://qiita.com/arabian9ts/items/61cfe6a5e2655e857e23
https://qiita.com/usamik26/items/56d0d3ba7a1300625f92
https://stackoverflow.com/questions/16993082/why-doesnt-git-recognize-that-my-file-has-been-changed-therefore-git-add-not-w/24316479