We're running into some workflow issues in the switch from hg to git (business requirement). In hg, we used to restrict outsource studios' access to proprietary code by creating subrepos with specific permissions settings. Our main hg repos would then have branches that pointed to the appropriate Source or DLL subrepos so they could easily be switched between.
The problem we're running into is that mimicking this setup in git seems impossible. Switching branches to one that does not contain a specific submodules does not delete the files of that submodule locally (intended git behavior). This creates a tedious manual deletion step that would likely cause problems if we rolled it out to the less technical people in the office. We need a system where people can checkout the tip from any other commit in the history and are guaranteed to have a working project, which can't happen if submodule content is not deleted in the current system.
Are there any alternatives in git to what we're trying to do?
You could use a post-checkout
client side hook. Basically, when you switch branches to one that uses another submodule, the post-checkout
hook will be run. In this hook, you can simply add code to remove all submodules that are not used by the current branch.
As hooks are not synced between remotes and local repos, you can follow this suggestion for getting the hooks to the people who will clone your repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With