A command-line tool to manage git worktrees.
- Persistent State Management: Worktree information is stored and tracked across sessions.
- Command Enhancements:
- Create: Register new worktrees in state, ensuring easy management and switching.
- Switch: Seamlessly switch to registered worktrees.
- Remove: Unregister and delete a worktree from the state.
- List: Display managed and unmanaged worktrees, highlighting the active one.
- Cleanup: Remove stale worktree entries from the state.
- Config: Show path of state file and count of managed worktrees.
This tool provides commands to create, list, remove, switch between, configure, and clean up git worktrees.
Use the config command to see where the state file is stored and the number of managed worktrees.
git-worktree-manager config
git-worktree-manager create <branch_name>
To create a new branch and worktree in one step, use the -b
/--create-branch
flag:
git-worktree-manager create -b <branch_name>
Displays both managed and unmanaged worktrees, indicating which is active.
git-worktree-manager list
Removes both the worktree and its Git branch if specified.
git-worktree-manager remove <branch_name> --remove-branch
Switches to the specified worktree and opens a shell in its directory.
git-worktree-manager switch <branch_name>
Removes entries for worktrees that no longer exist.
git-worktree-manager cleanup