Skip to main content

A better git worktree manager

Project description

git-worm

Git WORktree Manager

CI PyPI - Python Version PyPI PyPI - License

https://github.com/user-attachments/assets/916af237-e959-43fc-9046-067929ad874f

A better git worktree manager. Built with Xclif.

Why?

git worktree is powerful but raw. git-worm adds:

  • Automatic file management — gitignored files (.env, .venv, node_modules, etc.) are copied into new worktrees so switching feels like git switch
  • Smart package manager detection — pnpm/bun/Yarn PnP users don't get unnecessary node_modules copies
  • Nice UI — Rich-formatted output, tree views, colored status. You can also create multiple worktrees in one command!

Install

Requires Python 3.12+

pip install git-worm

Or with uv:

uv tool install git-worm

Usage

Because of Xclif, git-worm automatically gets a very nice-looking help page

Help

# Create a new worktree (copies .env, .venv, etc. automatically)
git worm new feat-login

# Create from a specific ref
git worm new feat-login --from-ref main

# List all worktrees
git worm list

# Print worktree path
git worm switch feat-login

# Remove a worktree
git worm rm feat-login

# Remove even if dirty
git worm rm feat-login --force

# Shell integration (add to .bashrc/.zshrc)
eval "$(git-worm shell-init)"
# Then: worm switch feat-login  (auto-cds)

Shell integration

git-worm shell-init outputs a worm shell function that wraps git-worm. This is needed because worm switch needs to cd into the worktree directory, which a plain subprocess can't do. All other commands are forwarded to git-worm as-is.

Add this to your .bashrc or .zshrc:

eval "$(git-worm shell-init)"

Then use worm instead of git-worm:

worm new feat-login
worm switch feat-login  # cds into the worktree
worm list

Configuration

Optional .git-worm.toml in your repo root:

[settings]
worktree_dir = ".worktrees"  # default

[[share]]
path = ".env*"
strategy = "copy"

[[share]]
path = "node_modules"
strategy = "ignore"

[[share]]
path = "target"
strategy = "symlink"

# Commands to run in the new worktree after creation
post_create = ["bun install"]

Strategies: copy, reflink (COW, falls back to copy), symlink, ignore.

When a config file is present, share rules replace the default behavior entirely.

Post-create hooks

The post_create array runs shell commands in the new worktree after it's created. This is useful for setting up dependencies when node_modules is skipped:

post_create = ["pnpm install", "cargo fetch"]

If no post_create hook is configured and node_modules was skipped, git-worm prints a hint with the detected install command.

Default Behavior (no config)

  1. All gitignored files/dirs are detected
  2. .git/ and .worktrees/ are excluded
  3. Files are plain-copied, directories are reflinked (with copy fallback)
  4. node_modules/ is skipped if pnpm, bun, or Yarn PnP is detected

License

Public Domain

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

git_worm-0.3.1.tar.gz (633.3 kB view details)

Uploaded Source

Built Distribution

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

git_worm-0.3.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file git_worm-0.3.1.tar.gz.

File metadata

  • Download URL: git_worm-0.3.1.tar.gz
  • Upload date:
  • Size: 633.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for git_worm-0.3.1.tar.gz
Algorithm Hash digest
SHA256 34ca3fd4d7ec3a99626d8387d390e386f802cab2ad292e3a52d66105f43d4b48
MD5 318d00297e5cdb16e0fb57815cc18882
BLAKE2b-256 88ef2a3ef3ff4ceba5bd510d1db78dcda1565347318cb61a28fa8e93574d188f

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_worm-0.3.1.tar.gz:

Publisher: release.yml on ThatXliner/git-worm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file git_worm-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: git_worm-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for git_worm-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44807c9bd08aaf8cd2bf66ff7cc82b064ed491fe90309a65ded423b47e116ac1
MD5 931f78cd552aeacfe40b1a3dc0bc61f3
BLAKE2b-256 485d30cf4810dbcf051d2a6f062ce13751ba312c1ca3b61b94d5c5f2de0f55fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_worm-0.3.1-py3-none-any.whl:

Publisher: release.yml on ThatXliner/git-worm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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