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

サブモジュールのmodified: .. (untracked content)をなんとかしたい

Posted at

はじめに

ルートでまとめて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 サブモジュールのパス

おわりに

なんか別の良い対処法がありそう

参考

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