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-worktreeAfter 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 add <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 initto set up the worktree structure - Use
fzf-git-worktree add feature-xto 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.zshThis project was based on 3rd/work and inspired by this blog post.
MIT License - see LICENSE file for details.
