{"id":51440706,"url":"https://github.com/stilliard/wt-cli","last_synced_at":"2026-07-05T11:30:31.131Z","repository":{"id":358750541,"uuid":"1242901458","full_name":"stilliard/wt-cli","owner":"stilliard","description":"`wt` helper for working with git worktrees, e.g. easily list and cd into them, with autocomplete!","archived":false,"fork":false,"pushed_at":"2026-05-18T22:23:40.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-19T00:43:38.216Z","etag":null,"topics":["git","git-worktree","worktree-manager","worktree-workflow","worktrees"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stilliard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-18T21:37:15.000Z","updated_at":"2026-05-18T22:16:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/stilliard/wt-cli","commit_stats":null,"previous_names":["stilliard/wt-cli"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/stilliard/wt-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stilliard%2Fwt-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stilliard%2Fwt-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stilliard%2Fwt-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stilliard%2Fwt-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stilliard","download_url":"https://codeload.github.com/stilliard/wt-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stilliard%2Fwt-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35153107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","git-worktree","worktree-manager","worktree-workflow","worktrees"],"created_at":"2026-07-05T11:30:29.184Z","updated_at":"2026-07-05T11:30:31.123Z","avatar_url":"https://github.com/stilliard.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wt\n\nA thin shell wrapper for `git worktree` with tab completion.\n\n## Install\n\nClone the repo (or just download `wt.sh`) to wherever you'd like, `~/.wt-cli` is an example of where you could put it:\n\n```sh\ngit clone https://github.com/stilliard/wt-cli.git ~/.wt-cli\n```\n\nThen add to your `~/.zshrc` or `~/.bashrc`, adjusting the path to match where you saved it:\n\n```sh\nsource ~/.wt-cli/wt.sh\n```\n\nThen reload your shell (`source ~/.zshrc`) or open a new terminal.\n\n## Usage\n\n```sh\nwt                        # list all worktrees\nwt \u003cname\u003e                 # cd into worktree by branch name\nwt mk \u003cbranch\u003e            # create worktree as sibling of current repo and cd into it\nwt mk \u003cbranch\u003e \u003cpath\u003e     # create worktree at a specific path and cd into it\nwt rm \u003cname\u003e              # remove a worktree\nwt prune                  # prune stale worktree refs\nwt ls                     # list worktrees (same as bare wt)\nwt cd \u003cname\u003e              # explicit cd (same as wt \u003cname\u003e)\nwt help                   # show usage\n```\n\nAliases: `add` → `mk`, `remove` → `rm`, `list` → `ls`\n\nTab completion works for subcommands and branch names in both bash and zsh.\n\n## Hooks\n\nPlace executable scripts in `.wt-hooks/\u003cevent\u003e` at your repo root to run custom logic around worktree operations.\n\n| Event | When | Runs in |\n|-------|------|---------|\n| `pre-mk` | Before creating a worktree (non-zero exit aborts) | Original repo |\n| `post-mk` | After creating a worktree | New worktree |\n| `pre-rm` | Before removing a worktree (non-zero exit aborts) | Worktree being removed |\n| `post-rm` | After removing a worktree | Original repo |\n\nEach hook receives the branch name and path via env vars `WT_BRANCH` and `WT_PATH`. The standard `OLDPWD` is also available, pointing to the directory you were in before the worktree was created.\n\n**Example** - copy env and install dependencies after creating a worktree:\n\n```sh\n#!/bin/sh\n# .wt-hooks/post-mk  (runs inside the new worktree)\ncp \"$OLDPWD/.env\" .env\nnpm install\n```\n\n```sh\nchmod +x .wt-hooks/post-mk\n```\n\n### Ad-hoc hooks for testing\n\n`wt mk` and `wt rm` also accept `--pre-hook PATH` and `--post-hook PATH` flags to run a single script for one invocation, without committing it to `.wt-hooks/`. The script receives the same `WT_BRANCH` / `WT_PATH` env vars; a failing `--pre-hook` aborts the operation.\n\n```sh\nwt mk feature-x --post-hook ./my-setup.sh\nwt rm feature-x --pre-hook  ./my-teardown.sh\n```\n\n## Copying gitignored files into new worktrees\n\nA new worktree is a fresh checkout, so untracked files like `.env` are not present in it. List the paths you want carried over in a `.worktreeinclude` file at your repo root, using `.gitignore` syntax:\n\n```text\n# .worktreeinclude\n.env\n.env.local\n.claude/settings.local.json\n```\n\nOn `wt mk`, any file that matches a pattern **and** is gitignored is copied into the new worktree. Tracked files are never duplicated. This is the same file Claude Code uses for `claude --worktree`, so one config serves both tools.\n\n## Requirements\n\n- git 2.5+\n- bash or zsh\n\n## Tests\n\nTests use [bats-core](https://github.com/bats-core/bats-core). Install it, then:\n\n```sh\n# Ubuntu/Debian\nsudo apt install bats\n\n# macOS\nbrew install bats-core\n```\n\n```sh\nbats test/wt.bats\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstilliard%2Fwt-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstilliard%2Fwt-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstilliard%2Fwt-cli/lists"}