jj-submod#
Manage git submodule pointers as ordinary jujutsu working-copy changes.
jj does not snapshot git submodules:
a submodule pointer bump you make with git never shows up in jj status. This tool
records that bump into your current working-copy commit (@), in place, so you can
squash/describe/push it like any other change -- without moving @ or hand-writing git
plumbing.
CLI reference#
jj-submod
Manage git submodule pointers as ordinary jj working-copy changes.
Operates on the git repo containing the current directory (a submodule when run from inside one), never the enclosing superproject.
Usage: jj-submod <COMMAND>
Commands:
bump Record submodule pointer(s) into the current repo's @
help Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
jj-submod bump
Record submodule pointer(s) into the current repo's @
Usage: jj-submod bump [OPTIONS] [PATHS]...
Arguments:
[PATHS]...
Submodule paths; empty means every submodule registered in this repo (not those nested inside them). --rev and --pick each require one path
Options:
--rev <REV>
Bump to this explicit commit (SHA, prefix, or ref) resolved inside the submodule, instead of the default target rule
--pick
Choose the target commit interactively with a fuzzy picker (jj submodules only)
--scope <REVSET>
Revset of commits the picker offers, evaluated in the submodule
[default: "~empty() & ~description(exact:\"\")"]
--force
Allow bumping to a commit not reachable from any remote. The unfetchable-commit warning is shown either way; without --force the bump is refused
-h, --help
Print help
The workflow it's built for#
cd mod
# hack in the submodule (a colocated jj repo of its own)
jj describe -m "fix thing"
jj bookmark track main@origin # once per submodule, if not already tracked
jj bookmark set main -r @ # advance the branch you push
jj git push
cd ..
jj-submod bump mod # @ now has `M mod`, editable as normal jj
bump reads the submodule's @ (here non-empty, so it targets @ itself); the
pointer lands in the superproject's working copy as an ordinary change.
How a bump is resolved#
With no override, the target commit for each submodule is:
- colocated jj repo (
.jj/at the submodule root):@empty → the parent@-;@non-empty →@itself. - plain git repo: the checked-out
HEAD.
(--rev and --pick override this.)