A CLI tool that makes git worktree easier to use with file sync and background tasks.
# Run directly
npx gitwm --help
# Or install globally
npm install -g gitwm
wm --helpgo install github.com/Devdha/wm@latestDownload from GitHub Releases
# Initialize in your project
wm init
# Create a worktree for a feature branch
wm add feature-login
# List all worktrees
wm list
# Remove a worktree
wm remove ../wm_myrepo/feature-login
# Remove worktree and delete branch
wm remove -b ../wm_myrepo/feature-loginWM uses a .wm.yaml file in your project root:
version: 1
worktree:
base_dir: "../wm_{repo}" # {repo} is replaced with repo name
sync:
- ".env" # Copy .env to worktree
- "apps/*/.env" # Glob patterns supported
- src: ".env.example"
dst: ".env"
mode: copy # or "symlink"
when: missing # or "always"
tasks:
post_install:
mode: background # Run async
commands:
- "pnpm install"Interactive setup to create .wm.yaml.
Create a new worktree. Options:
--path, -p: Custom worktree path
List all worktrees in table format.
Remove a worktree. Options:
-f, --force: Skip confirmation-b, --branch: Also delete the branch
MIT