简体   繁体   中英

How to commit to a git repo ignoring changes to submodules?

When I run git commit -a I would like it to skip committing changes to submodules.

(incase it matters, I want to have the latest version of all submodules but not commit these changes to the remote git repository).

How can this be done locally, so I can update submodules, but not commit changes to them?

So this works for eg:

git submodule foreach git origin master

Note that this seems similar to this question , but there seems some slight difference and the accepted answer doesn't work.

Check if the setting diff.ignoreSubmodules would help

 cd /path/to/my/repo
 git config diff.ignoreSubmodules all

Then a add+commit should only include files of the main repo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM