Skip to main content

Tools and git hooks to make it easier to work with submodules are updated frequently, enable a sort of virtual mono repo.

Project description

pre-commit Ruff image

Git Submodule Flow (smflow)

smflow is a lightweight toolset and set of Git hooks designed to make working with Git submodules significantly easier. It helps keep submodules in sync with the parent repository, enabling a "virtual monorepo" workflow — without giving up the benefits of repository modularity.


🚀 Features

  • Intuitively work with submodules through VS Code git interface.
  • Automatically attaches submodule HEADs to the commits referenced by the parent repository.
  • Quickly see how many changes the current submodule is behind the tracked branch.
  • Keeps local submodules in sync when switching branches in the parent project.
  • Automatically update .gitmodules in parent when changing locally checking out branches for submodules.
  • Configures Git for a smoother submodule experience:
    • Auto-checkout submodules on branch change
    • Auto-push submodule commits when pushing the parent

📦 Installation

Note: Requires uv to be installed.

Install smflow with:

uv tool install smflow

🛠️ Usage

From the root of your parent repository (the one that contains submodules), run:

smflow init

This will configure your repository with the appropriate Git settings and install the necessary hooks.

For help and available commands, run: smflow --help:

usage: smflow [-h]
              {init,install-hooks,configure-git,attach-heads,sync-from-local}
              ...

Make the flow of working with Git submodules smoother.

positional arguments:
  {init,install-hooks,configure-git,attach-heads,sync-from-local}
                        command to run
    init                Setup all functionality of smflow.
    install-hooks       Installs the githooks.
    configure-git       Configures some ergonomic settings for git submodules
                        in local `.gitconfig`.
    attach-heads        Attaches the head of the submodules to the branch and
                        reset to the commit-sha.
    sync-from-local     Updates .gitmodules from local file state.

options:
  -h, --help            show this help message and exit

🔍 What smflow init Does

🔗 Git Hooks

The following hooks will be installed:

  • Post-checkout hook

Automatically resets submodules to the correct commit when you checkout a branch in the parent repository.

  • Post-branch-change hook

Updates .gitmodules when you switch between branches, ensuring consistency across the repo.

⚙️ Git Configuration

smflow sets these recommended Git config values:

git config submodule.recurse true

Ensures submodules are automatically checked out when switching branches.

git config push.recurseSubmodules on-demand

Allows pushing submodule commits automatically when pushing the parent repository — if the submodules and parent share the same branch name. If not, Git will warn and suggest pushing submodules first.

⚠️ Limitations

  • smflow does not currently support recursive submodules, i.e. submodules within submodules.

🧩 Why smflow?

Managing submodules manually is tedious and error-prone. smflow minimizes the overhead and makes it easier to:

  • Stay in sync with your team
  • Avoid detached HEAD states in submodules
  • Prevent pushing parent branches that reference unpublished submodule commits

Whether you’re working with multiple shared libraries or simply trying to tame Git submodules, smflow provides a smoother, safer workflow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smflow-0.3.6.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smflow-0.3.6-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file smflow-0.3.6.tar.gz.

File metadata

  • Download URL: smflow-0.3.6.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for smflow-0.3.6.tar.gz
Algorithm Hash digest
SHA256 7029cc973f253357d6ae40d1bfc1425263faa0ee774eb23316ca62cc696aa5c4
MD5 e9cad3f77b13a555497de999d52df92d
BLAKE2b-256 f7ea9e3c5f3d4ccecd172e125d46f9dfe7a058b1078fd0dec556e62a620f119d

See more details on using hashes here.

File details

Details for the file smflow-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: smflow-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for smflow-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 31713801c0fdda4de41e42bf83d6f18dfe6475a6f5e84cb196efcbc66dcbedad
MD5 e9c2740671092bb5ceab4ec666d69d45
BLAKE2b-256 9117c5199dcec5dac27e6b1184e1a1a877ca5091449f0a4d3d944efeae6bd9c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page