Skip to content

banyan/zsh-fzf-git-worktree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-fzf-git-worktree

A Zsh plugin for managing Git worktrees with fzf integration.

Demo

Features

  • Interactive worktree management with fzf integration
  • Create, switch, remove worktrees and manage branches

Prerequisites

  • Zsh
  • Git
  • fzf

Installation

Manual Installation

# 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

Zinit

# Add to your ~/.zshrc
zinit light banyan/zsh-fzf-git-worktree

Usage

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

Getting Started

  1. In your Git repository, run fzf-git-worktree init to set up the worktree structure
  2. Use fzf-git-worktree new feature-x to create a new worktree for your feature
  3. Switch between worktrees with fzf-git-worktree (interactive)

Testing

This project includes a comprehensive test suite. To run the tests:

# Run all tests
./tests/run_tests.zsh

Acknowledgments

This project was based on 3rd/work and inspired by this blog post.

License

MIT License - see LICENSE file for details.

About

A Zsh plugin for managing Git worktrees with fzf integration.

Topics

Resources

License

Stars

Watchers

Forks

Languages