The most common way to accidentally pick up submodule changes is to do a pull, forget to submodule update, and then do a git commit -a (which will add the submodule changes). Is there a way to configure Git so that it ignore submodule changes unless I specifically request it? Is there some other way to molly guard the situation?
1 Answer
Have you tried an alias? Something as simple as alias gca="git submodule update; git commit -a" would work.
Alternatively, you can look into the wonderful world of Git Hooks.
Neither of these solutions are typically shareable, however. For a shareable solution, you will need to look into a solution like husky from the Node.js world.
git commit -a... I would definitely hand pick your changes to stage, then check your staged files before committing.-asaves me a little time and has very few ways to go wrong... unless there was a submodule update. I'm not alone in this...