git submodule status — current commits; summary --recursive for drift.
Removing a module clears the index entry, .gitmodules, the cache, and .git/modules.
0
lines
0
bytes
0
commands
terminal commands
About Git Submodule Command Generator
Build correct git submodule command blocks: add with optional branch tracking, clone with --recurse-submodules, update/init, status, and complete removal. Each section emits shell-speakable commands you can run top to bottom.
Features
Add a submodule with optional subtree and branch,Clone strategies: recursive clone or clone + update --init,Update commands with --remote for branch tracking,Status and drift summary commands,Complete removal clearing index, .gitmodules, cache, and .git/modules
How to Use
1. Paste the repository URL (https or git@). 2. Optionally set a target path and a branch. 3. Pick the operation: add, clone, update, status, fork, or remove. 4. Copy the printed command block and run it.
Examples
git submodule add --branch main https://github.com/org/lib.git lib — adds and pins the main branch. git clone --recurse-submodules — a full recursive clone. git submodule update --init --recursive — initializes after a plain clone.
Benefits
Correct command ordering and flags without consulting the man page, plus a removal sequence that would otherwise take research to reproduce.
Frequently Asked Questions
Are the commands uploaded anywhere?
No. Everything is assembled in your browser from the module URL and options you enter, then printed for you to copy into your terminal.
What is the basic add command?
git submodule add <url> <path>. The generator builds it from the repository URL, optional branch, and optional target subdirectory you provide.
How do I clone a repo that has submodules?
Use git clone --recurse-submodules <url>, or git clone <url> followed by git submodule update --init --recursive. Both are offered in the clone section.
How does branch tracking work?
Adding a submodule records a commit by default. If you set a branch, the tool adds the --branch flag and the update step uses --remote to advance the submodule to that branch's tip.
Why is removing a submodule multiple commands?
Git keeps metadata in several places: the index, .gitmodules, the working tree, and .git/modules. Proper removal clears all four, and the tool emits exactly those commands.
Does this work for GitHub and GitLab URLs?
Yes. Any https or git@ URL works. The tool also has a "generic" mode for non-GitHub mirrors so the path and branch are handled consistently.
How do I keep submodules updated after a pull?
git submodule update --init --recursive after pull, or git submodule update --remote for tracked branches. The tool provides a status command so you can see drift first.
Is there a command to see submodule status?
Yes. git submodule status prints each submodule's checked-out commit, and git submodule summary --recursive shows how far each has drifted.