{"id":28928235,"url":"https://github.com/rhymiz/wtu","last_synced_at":"2026-04-26T08:31:55.900Z","repository":{"id":299843904,"uuid":"1004322532","full_name":"rhymiz/wtu","owner":"rhymiz","description":"My worktree utils","archived":false,"fork":false,"pushed_at":"2025-06-18T15:17:16.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-08T06:56:10.815Z","etag":null,"topics":["git","utilities","worktrees"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhymiz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-18T12:56:47.000Z","updated_at":"2025-06-18T15:17:19.000Z","dependencies_parsed_at":"2025-06-18T16:24:36.019Z","dependency_job_id":"f0ccdec1-b567-466a-b67f-8897d1693921","html_url":"https://github.com/rhymiz/wtu","commit_stats":null,"previous_names":["rhymiz/wtu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rhymiz/wtu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhymiz%2Fwtu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhymiz%2Fwtu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhymiz%2Fwtu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhymiz%2Fwtu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhymiz","download_url":"https://codeload.github.com/rhymiz/wtu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhymiz%2Fwtu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32290500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T08:29:33.829Z","status":"ssl_error","status_checked_at":"2026-04-26T08:29:18.366Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","utilities","worktrees"],"created_at":"2025-06-22T14:12:38.411Z","updated_at":"2026-04-26T08:31:55.894Z","avatar_url":"https://github.com/rhymiz.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WTU (Worktree Utilities )\n\nA comprehensive set of bash utilities to simplify and enhance your Git worktree workflow. Work on multiple branches simultaneously without the hassle of constant switching.\n\n## 🚀 Features\n\n- **Easy worktree management** - Create, list, remove, and navigate worktrees with simple commands\n- **Remote branch support** - Quickly create worktrees from remote branches\n- **Pull request integration** - Check out GitHub pull requests in isolated worktrees\n- **Interactive switching** - Use fzf for fuzzy finding and switching between worktrees\n- **Status overview** - See the status of all worktrees at a glance\n- **Terminal integration** - Open worktrees in new terminal windows\n- **Batch operations** - Create worktrees for all remote branches at once\n- **Smart defaults** - Sensible naming conventions and directory organization\n- **Colorized output** - Clear, color-coded feedback for all operations\n- **Shell completion** - Tab completion support for bash and zsh\n\n## 📋 Prerequisites\n\n- Git 2.5+ (for worktree support)\n- Bash 4.0+\n- Optional: [fzf](https://github.com/junegunn/fzf) for interactive switching\n\n## 🛠️ Installation\n\n### Automated Install (Recommended)\n\nUse the install script for a guided installation:\n\n```bash\n# Download and run the installer\ncurl -fsSL https://raw.githubusercontent.com/rhymiz/wtu/main/install.sh | bash\n\n# Or if you've cloned the repo\n./install.sh\n```\n\nThe installer will:\n- Check Git version compatibility (2.5+ required)\n- Detect your shell (bash/zsh) and configure it automatically\n- Install shell completions for tab completion support\n- Optionally configure worktree settings\n- Install from local file or download from GitHub\n- Work on both macOS and Linux\n\n### Quick Install\n\n```bash\n# Download the utilities\ncurl -o ~/.git-worktree-utils.sh https://raw.githubusercontent.com/rhymiz/wtu/main/git-worktree-utils.sh\n\n# Add to your shell configuration\necho 'source ~/.git-worktree-utils.sh' \u003e\u003e ~/.bashrc\n# OR for zsh users\necho 'source ~/.git-worktree-utils.sh' \u003e\u003e ~/.zshrc\n\n# Reload your shell\nsource ~/.bashrc  # or source ~/.zshrc\n```\n\n### Manual Install\n\n1. Copy the script to your preferred location:\n   ```bash\n   cp git-worktree-utils.sh ~/.git-worktree-utils.sh\n   ```\n\n2. Source it in your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.):\n   ```bash\n   source ~/.git-worktree-utils.sh\n   ```\n\n3. Reload your shell or open a new terminal\n\n## ⚙️ Configuration\n\nConfigure the utilities by setting environment variables in your shell configuration:\n\n```bash\n# Base directory where worktrees will be created (default: ../)\nexport WORKTREE_BASE_DIR=\"$HOME/projects/worktrees\"\n\n# Prefix for worktree directory names (default: wt-)\nexport WORKTREE_PREFIX=\"branch-\"\n```\n\n## 📖 Commands Reference\n\n### Core Commands\n\n#### `wt-add \u003cbranch\u003e [name]`\nCreate a new worktree for a branch. If the branch doesn't exist, it will be created.\n\n```bash\n# Create worktree for existing branch\nwt-add feature/authentication\n\n# Create worktree with custom directory name\nwt-add feature/authentication auth-feature\n\n# Create new branch and worktree\nwt-add feature/new-feature\n```\n\n#### `wt-list` (alias: `wtl`)\nList all worktrees with their current branch and commit information.\n\n```bash\nwt-list\n# Output:\n# [1] /home/user/project/../wt-feature-auth\n#     Commit: abc1234\n#     Branch: feature/authentication\n# [2] /home/user/project/../wt-bugfix\n#     Commit: def5678\n#     Branch: bugfix/issue-123\n```\n\n#### `wt-cd \u003cbranch-or-number\u003e` (alias: `wtc`)\nChange directory to a worktree by branch name or number from the list.\n\n```bash\n# Navigate by branch name\nwt-cd feature/authentication\n\n# Navigate by number from wt-list\nwt-cd 2\n```\n\n#### `wt-remove \u003cbranch-or-path\u003e` (alias: `wtr`)\nRemove a worktree and clean up its reference.\n\n```bash\n# Remove by branch name\nwt-remove feature/authentication\n\n# Remove by path\nwt-remove /path/to/worktree\n```\n\n#### `wt-status` (alias: `wts`)\nShow the status of all worktrees, including uncommitted changes.\n\n```bash\nwt-status\n# Output:\n# ● main (clean)\n#   /home/user/project\n# ● feature/authentication (3 changes)\n#   /home/user/project/../wt-feature-auth\n# ● bugfix/issue-123 (missing)\n#   /home/user/project/../wt-bugfix\n```\n\n### Remote Operations\n\n#### `wt-add-remote \u003cremote-branch\u003e [local-branch]`\nCreate a worktree tracking a remote branch.\n\n```bash\n# Create worktree from remote branch\nwt-add-remote origin/feature/remote-feature\n\n# Specify local branch name\nwt-add-remote origin/feature/remote-feature my-local-feature\n```\n\n#### `wt-add-all-remote [remote]`\nCreate worktrees for all remote branches that don't already have local counterparts.\n\n```bash\n# Create worktrees for all origin branches\nwt-add-all-remote\n\n# Create worktrees for specific remote\nwt-add-all-remote upstream\n```\n\n### Advanced Commands\n\n#### `wt-pr \u003cpr-number\u003e`\nCreate a worktree for a GitHub pull request.\n\n```bash\n# Checkout PR #123\nwt-pr 123\n```\n\n#### `wt-switch`\nInteractive worktree switcher using fzf (requires fzf to be installed).\n\n```bash\nwt-switch\n# Opens interactive fuzzy finder with preview\n```\n\n#### `wt-open \u003cbranch\u003e`\nOpen a worktree in a new terminal window (supports Ghostty, Warp, iTerm, Terminal.app, gnome-terminal, konsole, xterm).\n\n```bash\nwt-open feature/authentication\n```\n\n#### `wt-clean`\nClean up stale worktree entries that no longer exist on disk.\n\n```bash\nwt-clean\n```\n\n#### `wt-help`\nDisplay help information for all commands.\n\n```bash\nwt-help\n```\n\n## 🎯 Common Workflows\n\n### Feature Development\n\n```bash\n# Start working on a new feature\nwt-add feature/user-authentication\n\n# Navigate to the worktree\nwt-cd feature/user-authentication\n\n# Work on your feature...\n# Meanwhile, if you need to fix something in main:\nwt-cd main\n\n# Check status across all worktrees\nwt-status\n\n# When done, remove the feature worktree\nwt-remove feature/user-authentication\n```\n\n### Code Review Workflow\n\n```bash\n# Review a pull request\nwt-pr 456\n\n# Or checkout a colleague's remote branch\nwt-add-remote origin/colleague/feature\n\n# Open in new terminal for side-by-side comparison\nwt-open colleague/feature\n\n# Clean up after review\nwt-remove pr-456\n```\n\n### Multiple Feature Development\n\n```bash\n# Set up worktrees for all remote features\nwt-add-all-remote\n\n# See what you have\nwt-list\n\n# Use interactive switcher to jump between them\nwt-switch\n\n# Check which ones have uncommitted work\nwt-status\n```\n\n### Emergency Hotfix\n\n```bash\n# Quickly create a hotfix worktree\nwt-add hotfix/critical-bug\n\n# Your current work remains untouched in other worktrees\nwt-cd hotfix/critical-bug\n\n# Fix the bug, push, and remove\ngit add . \u0026\u0026 git commit -m \"Fix critical bug\"\ngit push origin hotfix/critical-bug\nwt-remove hotfix/critical-bug\n```\n\n## 🔌 Shell Completion\n\nTab completion is automatically installed and configured by the install script. If you need to manually set it up:\n\n### Bash Completion\n\n```bash\n# Download completion file\ncurl -o ~/.wtu-completions.bash https://raw.githubusercontent.com/rhymiz/wtu/main/completions/bash/wtu-completions.bash\n\n# The main script will automatically source it\n```\n\n### Zsh Completion\n\n```bash\n# Create completion directory\nmkdir -p ~/.wtu/completions/zsh\n\n# Download completion file\ncurl -o ~/.wtu/completions/zsh/_wtu https://raw.githubusercontent.com/rhymiz/wtu/main/completions/zsh/_wtu\n\n# The main script will automatically add to fpath\n```\n\n### What Can Be Completed\n\n- **Branch names** - When creating or switching to worktrees\n- **Remote branches** - When adding remote worktrees\n- **Worktree numbers** - When using `wt-cd` with list numbers\n- **Remote names** - When specifying which remote to use\n- **File paths** - When removing worktrees by path\n\nExample usage:\n```bash\nwt-add fea\u003cTAB\u003e              # Completes to feature branches\nwt-cd \u003cTAB\u003e                  # Shows all worktree branches and numbers\nwt-add-remote origin/\u003cTAB\u003e   # Shows all origin branches\nwt-remove \u003cTAB\u003e              # Shows current worktrees\n```\n\n## 💡 Tips and Tricks\n\n### 1. Organize Your Worktrees\n```bash\n# Set a dedicated directory for all worktrees\nexport WORKTREE_BASE_DIR=\"$HOME/dev/worktrees/$(basename $(pwd))\"\n```\n\n### 2. Use Descriptive Prefixes\n```bash\n# Different prefixes for different types\nexport WORKTREE_PREFIX=\"feat-\"  # for features\nexport WORKTREE_PREFIX=\"fix-\"   # for bugfixes\nexport WORKTREE_PREFIX=\"pr-\"    # for pull requests\n```\n\n### 3. Combine with Git Aliases\n```bash\n# Add to your .gitconfig\n[alias]\n    wt = worktree\n    wtl = !bash -c 'source ~/.git-worktree-utils.sh \u0026\u0026 wt-list'\n```\n\n### 4. Quick Status Check\n```bash\n# Add to your prompt to show current worktree\nPS1='[\\W$(git worktree list --porcelain | grep -c \"^worktree\" | sed \"s/1//\")WT] $ '\n```\n\n### 5. Cleanup Script\n```bash\n# Remove all worktrees except main\nfor wt in $(git worktree list --porcelain | grep \"^worktree\" | cut -d' ' -f2- | grep -v \"$(pwd)\"); do\n    wt-remove \"$wt\"\ndone\n```\n\n## 🔧 Troubleshooting\n\n### Worktree Already Exists\n```bash\n# Error: fatal: 'feature/x' is already checked out at '/path/to/worktree'\n# Solution: Remove the existing worktree first\nwt-remove feature/x\nwt-add feature/x\n```\n\n### Cannot Remove Worktree\n```bash\n# Error: fatal: 'worktree' contains modified or untracked files\n# Solution: Force remove (loses uncommitted changes!)\ngit worktree remove --force /path/to/worktree\n```\n\n### Missing Worktree Directory\n```bash\n# If you deleted a worktree directory manually\nwt-clean  # This will clean up the git references\n```\n\n### Permission Issues\n```bash\n# Ensure the base directory exists and is writable\nmkdir -p \"$WORKTREE_BASE_DIR\"\nchmod 755 \"$WORKTREE_BASE_DIR\"\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Feel free to:\n\n1. Fork the repository\n2. Create a feature branch (`wt-add feature/amazing-feature`)\n3. Commit your changes\n4. Push to the branch\n5. Open a Pull Request\n\n### Ideas for Contribution\n\n- Support for more terminal emulators\n- Integration with tmux/screen\n- Worktree templates\n- Integration with other Git hosting services (GitLab, Bitbucket)\n- Worktree-specific git hooks\n- Performance optimizations for large repositories\n\n## 📄 License\n\nThis project is licensed under the MIT License - see below for details:\n\n```\nMIT License\n\nCopyright (c) 2024 Git Worktree Utilities\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n## 🙏 Acknowledgments\n\n- Inspired by the Git worktree feature and the need for better tooling\n- Thanks to the Git community for continuous improvements to worktree functionality\n- Special thanks to contributors and users who provide feedback and improvements\n\n---\n\n**Happy branching!** 🌳\n\nIf you find these utilities helpful, consider starring the repository and sharing with your team!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhymiz%2Fwtu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhymiz%2Fwtu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhymiz%2Fwtu/lists"}