A Zsh plugin for managing Git worktrees with fzf integration.
- Interactive worktree management with fzf integration
- Create, switch, remove worktrees and manage branches
- Zsh
- Git
- fzf
# Clone the repository
git clone https://github.com/banyan/zsh-fzf-git-worktree.git ~/path/to/zsh-fzf-git-worktree
# Add to your ~/.zshrc
source ~/path/to/zsh-fzf-git-worktree/zsh-fzf-git-worktree.zsh
# Add to your ~/.zshrc
zinit light banyan/zsh-fzf-git-worktree
After installation, the fzf-git-worktree
command will be available:
fzf-git-worktree # Interactive worktree switcher
fzf-git-worktree i, init # Setup "fzf-git-worktree" in current directory
fzf-git-worktree new <name> # Create new worktree with branch <name> if it doesn't exist
fzf-git-worktree rm, remove <name> # Remove worktree
fzf-git-worktree rm, remove -f, --force <name> # Force remove worktree (even with uncommitted changes)
fzf-git-worktree rm, remove --all # Remove all worktrees except main
fzf-git-worktree rm, remove --all --force # Force remove all worktrees except main
fzf-git-worktree ls, list # List worktrees
fzf-git-worktree help # Print usage
- In your Git repository, run
fzf-git-worktree init
to set up the worktree structure - Use
fzf-git-worktree new feature-x
to create a new worktree for your feature - Switch between worktrees with
fzf-git-worktree
(interactive)
This project includes a comprehensive test suite. To run the tests:
# Run all tests
./tests/run_tests.zsh
This project was based on 3rd/work and inspired by this blog post.
MIT License - see LICENSE file for details.