はじめに
ルートでまとめてpushしてもサブモジュールディレクトリのステータスが表示されてしまうのでなんとかしたい
問題
こんな感じで表示され続ける
% git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: ... (untracked content)
no changes added to commit (use "git add" and/or "git commit -a")
対処
stackoverflowでいくつか対処法が提示されていましたが、1番わかりやすくて手っ取り早そうなものを選びました。以下のコマンドで該当箇所の変更を追跡しないようにできるみたいです
% git update-index --assume-unchanged サブモジュールのパス
これでmodified: .. (untracked content)が表示されなくなりました
% git status
On branch master
nothing to commit, working tree clean
以下のコマンドで再度追跡対象にもできるみたいです
git update-index --no-assume-unchanged サブモジュールのパス
おわりに
なんか別の良い対処法がありそう
参考