Last active
November 5, 2025 06:19
-
-
Save bfollington/dd61c7eaeee729b4c3a1b15dc2bc230c to your computer and use it in GitHub Desktop.
Worktree convenience aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wt-new() { | |
| branch=$1 | |
| git worktree add .worktrees/$branch -b $branch && cd .worktrees/$branch | |
| git config core.hooksPath ../../.githooks | |
| } | |
| wt-checkout() { | |
| branch=$1 | |
| git worktree add .worktrees/$branch $branch 2>/dev/null || \ | |
| git worktree add .worktrees/$branch -b $branch --track origin/$branch | |
| cd .worktrees/$branch | |
| git config core.hooksPath ../../.githooks | |
| } | |
| wt-sync() { | |
| git fetch origin && git rebase origin/main | |
| } | |
| wt-remove() { | |
| branch=$1 | |
| git worktree remove .worktrees/$branch | |
| } | |
| wt-list() { | |
| git worktree list | |
| } | |
| wt-done() { | |
| branch=$(git branch --show-current) | |
| cd ../.. && git worktree remove .worktrees/$branch | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment