Skip to content

mateusauler/git-worktree-switcher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git worktree switcher ⚡

Switch between git worktrees with speed. ⚡

demo of switching between git worktrees

This fork includes:

  • Fish completions work dinamically.
  • The list subcommand is now names, which lists out only the worktree basenames.
  • Completions work with spaces & special characters.
  • Doesn't create a new shell instance when changing directory.
  • Running wt, instead of wt -, goes to the main worktree (similar to how cd itself works).
  • Checks for updates automatically once per day on the first invocation.

Installation

Download the script from the Release section.

Make the script executable.

$ chmod +x wt

Copy the executable to any directory in your $PATH

$ sudo cp wt /usr/local/bin

Tab Autocompletion ⚡

For Bash

sudo cp wt_completion /etc/bash_completion.d

Add this to the end of your ~/.bashrc:

eval "$(command wt init bash)"

For ZSH

Note: completion file for zsh has _ prefix

Find paths where you can store your completion

print -rl -- $fpath

Copy completion script to one of that location and restart the shell.

sudo cp _wt_completion <one-of-$fpath>

exec zsh

Add this to the end of your ~/.zshrc:

eval "$(command wt init zsh)"

For Fish

cp wt.fish ~/.config/fish/completions

Add this to the end of your ~/.config/fish/config.fish:

command wt init fish | source

Tab autocompletion works for switching between your worktrees.

wt <TAB> <TAB>

# OR

wt <completion-characters> <TAB>

Usage

Switch between worktrees. You can do a text search to change to the worktree directory.

$ wt <worktree-name/search-term>

Go to root worktree directory

$ wt

List out all the worktree names.

$ wt names

Show help message

$ wt help

Update to the latest release

$ wt update

Show the CLI version

$ wt version

About

Switch between git worktrees with speed. ⚡

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%