Note
This entire Go module was generated by Google's Gemini AI initially. While it has been tested/reviewed for the described functionality, it may still contain unexpected behaviors. Use with discretion.
A simple, zero-dep robust command-line tool for updating Git submodules with ease.
submoduler is a smart utility that handles the common pain points of managing Git submodules. It ensures your submodules are initialized, fetches the latest changes, and updates them either to their latest tracked commit or to a specific commit, tag, or branch you define.
-
Automatic Initialization: Clones and initializes any missing submodules before starting.
-
Safe Default Updates: Updates submodules to the latest commit on their tracked remote branch, correctly handling "detached HEAD" states.
-
Specific Version Pinning: Easily check out a specific commit hash, release tag, or branch for any submodule.
-
Cloning Progress: Shows real-time progress when cloning new submodules.
-
Verbose Output: Optional
-vflag to see the underlying Git commands being executed.
Ensure you have Go installed and your $GOPATH/bin (or $HOME/go/bin) is in your system's PATH.
go install github.com/saswatamcode/submoduler@latest
Run the tool from the root directory of your Git repository.
submoduler [flags] [submodule1=ref] [submodule2=ref] ...
-v: Enable verbose mode to show all Git commands being run.
-
[submodule_path=ref](Optional): Specify a target for one or more submodules.-
submodule_path: The relative path to the submodule. -
ref: The Git reference to check out (can be a commit hash, tag, or branch name).
-
If no arguments are provided, submoduler will update all submodules to the latest commit on their respective tracked branches.
1. Update all submodules to their latest versions:
submoduler2. Update a specific submodule to a release tag:
submoduler path/to/my-lib=v2.5.13. Update multiple submodules to different refs:
submoduler libs/api=a1b2c3d4 common/utils=main
4. Update all submodules with verbose output:
submoduler -v