up until very recently i was managing modules via copy/paste but then i discovered submodules & with the single branch clone its becoming more sensible to use this feature.
however i have a couple of questions and hopefully someone could help me with them.
- is it possible to save a module changes in the main git index instead of the module it self ?
what i mean is am trying to have a central modules with the basic/essential setup on github & under each project that pull/require this module, the project can make changes that is related to him alone & save this changes to his git index, so we can clone the project later and all the changes will be there.
if this is not possible, what would be a viable alternative ?
# Partial Solution
use git diff --submodule=diff > modules_changes.diff
& later simply use git apply modules_changes.diff
however this wont work with changed files "deleted/added files"
# Better Solution
setup a repo per module & have branches for each project
- how to auto set the module head on add ?
atm when you want to push something to the module while you are working on a project. the steps are usually
- cd into the module dir
- add & commit ur changes
- push the new changes while specifying the head we will push to
however i was wondering if there is a way to automate that, so something like auto push on commit will work directly without the need to manually do the steps above on each module change.
question from:https://stackoverflow.com/questions/65867606/is-it-possible-to-save-submodules-changes-to-the-main-git-index