An open API service indexing awesome lists of open source software.

https://github.com/guywaldman/wt

CLI for sane work with git worktrees
https://github.com/guywaldman/wt

cli git

Last synced: 2 days ago
JSON representation

CLI for sane work with git worktrees

Awesome Lists containing this project

README

          

# wt

Small git worktree helper CLI, focused on ergonomics.

> [!WARNING]
>
> This CLI, while lightweight, is not battle-tested.
> It should not have any destructive behavior, but be sure to commit or stash changes before using it just in case.

---

## Installation

```sh
# Homebrew
brew install guywaldman/tap/wt

# From source
cargo install --git https://github.com/guywaldman/wt --locked
```

## Shell setup

```sh
# zsh
echo 'eval "$(wt init zsh)"' >> ~/.zshrc

# bash
echo 'eval "$(wt init bash)"' >> ~/.bashrc

# fish
echo 'wt init fish | source' >> ~/.config/fish/config.fish
```

This enables completions and makes `wt switch` change the current shell's cwd.

## Commands

Relative `[path]` arguments are resolved from the worktree root, not the current worktree.

```sh
# Lists all worktrees as ``.
wt list

# Creates a worktree for `branch`. If the branch does not exist, it is created from the current `HEAD`.
wt add [path]

# Switches cwd to `branch`'s worktree. Creates it first if it does not exist.
wt switch [path]

# Copies current changes into `branch`'s worktree. Copies unstaged changes by default; `--staged` copies staged changes and stages them in the target worktree.
wt fork [path] [--staged] [-- ...]

# Removes the linked worktree for `branch`. Refuses dirty worktrees unless `--force` is passed.
wt remove [--force]
```