Skip to content

Instantly share code, notes, and snippets.

@andry81
Last active March 21, 2025 14:14
Show Gist options
  • Save andry81/b0000d2ddfa890f7ac68f1cabb6c1978 to your computer and use it in GitHub Desktop.
Save andry81/b0000d2ddfa890f7ac68f1cabb6c1978 to your computer and use it in GitHub Desktop.
Git modules experience
  • git_modules_experience.md
  • 2025.03.21
  1. DESCRIPTION
  2. INVESTIGATION
  3. CONSLUSION
  4. USAGE
  5. RELATED ISSUES

  1. DESCRIPTION

Git modules experience.


  1. INVESTIGATION

kernel.org:

Github:

Stackoverflow:


  1. CONSLUSION

Seems vcstool and the forks is the best choice here to avoid .gitmodules file in first place.

Discussion:
Status of vcstool : dirk-thomas/vcstool#242

Forks:
https://github.com/aaronplusone/vcstool/tree/feature-sparse-checkouts
https://github.com/MaxandreOgeret/vcstool2 (https://pypi.org/project/vcstool2/)

On another hand the .gitmodules file might be required in some circumstances and it's presence (and vcstool file too as well if hashes are used) in the default branch is not preferred, because will interfere with source files commits and may be left in the desync state because of a rewrite in a submodule, which will require a rewrite in all dependent repositories and basically is pain in arse. So better just push the .gitmodules file out of a default branch into standalone branch where you can rewrite without affecting the sources.

For example, use master branch to store sources without submodules and master-modules (or master-all) branch to store sources plus .gitmodules file to checkout default branch with head submodules or with freezed submodules. Later you can just rewrite master-modules without affecting the source files from master (there won't be merges from master-modules to master, only from master into master-modules).

This approach can use both the vcstool as a more convenient tool by default and the .gitmodules file, where it is might be required because of circumstances. For example, for a ZIP archive (Download ZIP button) as were noted here.


  1. USAGE

https://github.com/andry81/externals


  1. RELATED ISSUES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment