Home > Net >  Untracked git submodules
Untracked git submodules

Time:05-19

For one of my project I decided to use submodules.
They are nice to keep different plugins for application in separate repos, but I have one issue.
Any time I have uncommited changes in the submodule I cannot do anything with the main repo, it keeps track of the submodule and the moment I try to do a commit or anything I have to choose between loosing all my submodule changes or commit them first.

Its a huge pain to work on the main repo because the submodules getting in the way all the time. I have lost changes in the submodule so many times due to main repo deleting them when I was stashing or changing anything in the main repo.

So my question is, is there a way to tell git to only clone a subrepository but completely ignore it afterwards?

CodePudding user response:

I have to choose between loosing all my submodule changes or commit them first.

You should be able to add and commit, while ignoring your submodules:

submodule.<name>.ignore

Defines under what circumstances "git status" and the diff family show a submodule as modified.
When set to "all", it will never be considered modified (but it will nonetheless show up in the output of status and commit when it has been staged).

  • Related