You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
When using git submodules inside a monorepo one must take care of the following steps manually:
Initiating git submodules (when cloning new project)
Cloning the repo with --recurse-submodules or performing git submodule update --init or git submodule init; git submodule update. This could be tackled with something like demorepo update or something like that.
Updating git submodules (when changes have been made to upstream)
One must invoke git submodule update --remote, perhaps we can just use the previous command demorepo update, probably we always want the latest upstream version.
Tracking particular branches of submodules in demorepo parent branches
When tracking a particular branch of the subproject one must update git config and .gitmodules references with git config -f .gitmodules submodule.<projectName>.branch <branchname>.
This could be automated by something like demorepo project --branch develop. However reflecting the changes on the config is tricky, all options have pros and cons:
Reflect particular branch of submodule on config.yml. Dangerous as merging between parent demorepo branches would result in ovrewriting this info.
Ignoring tracked branch on demorepo and just rely on .gitmodules file to track the branches (this file is not merged between branches).
Reflect particular changes in config.yml by project and branch:
This would be nice, as we could event default common patters as creating default gitflow branches.
Switching branches
When switching branches one should invoke git submodule update --remote to fetch the correct commit for the submodules, otherwise changes could be commited. One can also use git checkout <branch> --resource-submodules to automatically change to the correct commit.
Demorepo could just provide a particular checkout command enforcing this, or perhaps this behaviur can be ensured into git config
Another option could be to create a git hook to do ensure this or to launch a warning.
Another issue is that is a branch is tracking a submodule and another one isn't (eg: you added a new project to develop but it does not yet exists in master), and you checkout between them the untracked submodule would appear as an untracked directory.
The text was updated successfully, but these errors were encountered:
When using git submodules inside a monorepo one must take care of the following steps manually:
Initiating git submodules (when cloning new project)
Cloning the repo with
--recurse-submodules
or performinggit submodule update --init
orgit submodule init; git submodule update
. This could be tackled with something likedemorepo update
or something like that.Updating git submodules (when changes have been made to upstream)
One must invoke
git submodule update --remote
, perhaps we can just use the previous commanddemorepo update
, probably we always want the latest upstream version.Tracking particular branches of submodules in demorepo parent branches
When tracking a particular branch of the subproject one must update git config and
.gitmodules
references withgit config -f .gitmodules submodule.<projectName>.branch <branchname>
.This could be automated by something like
demorepo project --branch develop
. However reflecting the changes on the config is tricky, all options have pros and cons:Reflect particular branch of submodule on
config.yml
. Dangerous as merging between parent demorepo branches would result in ovrewriting this info.Ignoring tracked branch on demorepo and just rely on
.gitmodules
file to track the branches (this file is not merged between branches).Reflect particular changes in config.yml by project and branch:
This would be nice, as we could event default common patters as creating default gitflow branches.
Switching branches
When switching branches one should invoke
git submodule update --remote
to fetch the correct commit for the submodules, otherwise changes could be commited. One can also usegit checkout <branch> --resource-submodules
to automatically change to the correct commit.Demorepo could just provide a particular checkout command enforcing this, or perhaps this behaviur can be ensured into
git config
https://git-scm.com/docs/git-config
Another option could be to create a
git hook
to do ensure this or to launch a warning.Another issue is that is a branch is tracking a submodule and another one isn't (eg: you added a new project to develop but it does not yet exists in master), and you checkout between them the untracked submodule would appear as an untracked directory.
The text was updated successfully, but these errors were encountered: