{"id":30146385,"url":"https://github.com/shutootaki/gwm","last_synced_at":"2025-08-11T09:20:11.390Z","repository":{"id":301898373,"uuid":"1009312362","full_name":"shutootaki/gwm","owner":"shutootaki","description":"Git worktree manager cli. Switch Git contexts with zero friction. Review pull requests, create feature branches, and clean up your workspace—all from a single interactive CLI.","archived":false,"fork":false,"pushed_at":"2025-07-06T23:59:32.000Z","size":558,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-08T22:24:52.818Z","etag":null,"topics":["claude-code","cli","gemini-cli","git","git-worktree","ink","react","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/shutootaki.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}},"created_at":"2025-06-26T23:41:33.000Z","updated_at":"2025-08-08T09:25:02.000Z","dependencies_parsed_at":"2025-06-29T13:50:41.217Z","dependency_job_id":"eba5cf2d-14e1-4908-953f-e7c226de5504","html_url":"https://github.com/shutootaki/gwm","commit_stats":null,"previous_names":["shutootaki/gwm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shutootaki/gwm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutootaki%2Fgwm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutootaki%2Fgwm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutootaki%2Fgwm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutootaki%2Fgwm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shutootaki","download_url":"https://codeload.github.com/shutootaki/gwm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutootaki%2Fgwm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269857964,"owners_count":24486448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"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":["claude-code","cli","gemini-cli","git","git-worktree","ink","react","typescript"],"created_at":"2025-08-11T09:20:08.678Z","updated_at":"2025-08-11T09:20:11.358Z","avatar_url":"https://github.com/shutootaki.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eEnglish\u003c/strong\u003e | \u003ca href=\"README_JA.md\"\u003e日本語\u003c/a\u003e\n\u003c/p\u003e\n\n# gwm – Git Worktree Manager\n\n\u003e ⚡ **Switch Git contexts in milliseconds**. Review pull requests, create feature branches, and clean up your workspace—all from a single interactive CLI.\n\n\u003cdiv align=\"center\"\u003e\n\n[![npm version](https://img.shields.io/npm/v/@shutootaki/gwm?color=blue\u0026style=flat-square)](https://www.npmjs.com/package/@shutootaki/gwm)\n[![license MIT](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE)\n[![CI](https://github.com/shutootaki/gwm/actions/workflows/ci.yml/badge.svg)](https://github.com/shutootaki/gwm/actions/workflows/ci.yml)\n[![Downloads](https://img.shields.io/npm/dm/@shutootaki/gwm?style=flat-square)](https://www.npmjs.com/package/@shutootaki/gwm)\n\n\u003c/div\u003e\n\n## 🚀 Why gwm?\n\nWhen you're juggling multiple pull requests or hotfixes at once, running `git checkout` and `git pull` over and over or keeping multiple local clones around can slow you down. **gwm** leverages Git's native _worktree_ feature and a pleasant UI to:\n\n- **⚡ Swap tasks in milliseconds** — no more stash/checkout dance\n- **🎯 Spin up a worktree from any remote branch in one go**\n- **🧹 Keep your laptop squeaky-clean** — detect and safely remove stale branches\n- **🎨 Do it all without leaving the terminal** — powered by an Ink-based interactive finder\n\n## 📋 Command overview\n\n| Command                 | Purpose                                             | Highlights                                     |\n| ----------------------- | --------------------------------------------------- | ---------------------------------------------- |\n| `gwm list` / `gwm ls`   | List worktrees in the current repository            | Colored status, HEAD hash                      |\n| `gwm add`               | Create a new worktree                               | New branch / remote PR, interactive validation |\n| `gwm go`                | Jump to a worktree or open it in VS Code/Cursor     | Launch subshell, editor flags                  |\n| `gwm remove` / `gwm rm` | Remove worktrees                                    | Multi-select, force mode, branch cleanup       |\n| `gwm clean`             | Auto-detect safe-to-delete worktrees and clean them | Enter deletes all / -n dry-run                 |\n| `gwm pull-main`         | Run `git pull` in all main worktrees                | Keep bases up to date                          |\n\n_Note: Run `gwm help \u003ccommand\u003e` for details on each command._\n\n## 📦 Installation\n\n### npm (Recommended)\n\n```bash\n# Global install\nnpm install -g @shutootaki/gwm\n\n# or use npx (no installation needed)\nnpx @shutootaki/gwm\n```\n\n### Alternative Installation Methods\n\n```bash\n# Using pnpm\npnpm add -g @shutootaki/gwm\n\n# Using yarn\nyarn global add @shutootaki/gwm\n\n# Using bun\nbun add -g @shutootaki/gwm\n```\n\n## 🎯 Quick start\n\n```bash\n# In a Git repository\n$ gwm add                   # Interactive mode: enter branch name → Enter\n$ gwm go feature/my-branch  # Jump to the worktree\n$ gwm go --code             # Open VS Code instantly\n```\n\nWhen reviewing a pull request:\n\n```bash\n$ gwm add 1234-fix-layout -r --code  # Create a worktree from the remote branch and open VS Code immediately 🚀\n```\n\n**Weekend cleanup:**\n\n```bash\n$ gwm clean             # Clean up safe-to-delete worktrees interactively\n```\n\n## 🗂️ Default directory layout\n\n```\n~/git-worktrees/\n└─ \u003crepo-name\u003e/\n   ├─ main/\n   ├─ feature-user-auth/\n   └─ hotfix-critical-bug/\n```\n\nYou can change the base path in `~/.config/gwm/config.toml` (or `~/.gwmrc`).\n\n## ⚙️ Configuration file\n\nCreate `~/.config/gwm/config.toml` to fine-tune behavior:\n\n```toml\n# Base path for worktrees (default: ~/git-worktrees)\nworktree_base_path = \"/Users/me/dev/worktrees\"\n\n# What to do with the local branch when deleting a worktree\n#   \"auto\"  – delete automatically when safe\n#   \"ask\"   – prompt for confirmation (default)\n#   \"never\" – never delete\nclean_branch = \"ask\"\n\n# Copy gitignored files from main worktree (e.g., .env files)\n# By default, gitignored files cannot be copied to the new worktree.\n# Enable this setting to copy them to the new worktree.\n[copy_ignored_files]\nenabled = true  # Enable/disable the feature\npatterns = [\".env\", \".env.*\", \".env.local\", \".env.*.local\"]  # Files to copy\nexclude_patterns = [\".env.example\", \".env.sample\"]  # Files to exclude\n```\n\n## 📖 Command reference\n\nBelow are the main commands. Run `gwm \u003ccommand\u003e --help` for more information.\n\n### `gwm list` (alias: `ls`)\n\nList worktrees that belong to the current project.\n\n```text\nSTATUS  BRANCH            PATH                              HEAD\n*       feature/new-ui    /Users/me/project                 a1b2c3d\nM       main              ~/git-worktrees/project/main      123abc4\n-       hotfix/logfix     ~/git-worktrees/project/logfix    c7d8e9f\n```\n\n- **STATUS meanings:**\n  - `* ACTIVE`: The worktree you're currently in\n  - `M MAIN`: Main branches such as `main` or `master`\n  - `- OTHER`: Any other worktree\n\n---\n\n### `gwm add [branch_name]`\n\nCreate a new worktree. Comes with an interactive UI.\n\n- **Run without arguments (`gwm add`):**\n  - Launches a UI to type a new branch name. Branch names are validated in real time and the path preview is shown.\n  - Press `Tab` to switch to mode for selecting a remote branch to create a worktree from—perfect for reviewing PRs.\n  - You can pass flags to immediately open the worktree in VS Code or Cursor.\n\n- **Run with arguments:**\n  - `gwm add feature/new-login`: Create a new branch and worktree named `feature/new-login`.\n  - `gwm add existing-branch`: Create a worktree from an existing local branch `existing-branch`.\n  - `gwm add pr-branch -r`: Create a worktree from the remote branch `origin/pr-branch`.\n\n- **Key options:**\n  - `-r, --remote`: Switch to mode for creating from a remote branch.\n  - `--from \u003cbase_branch\u003e`: Base branch for new branches (default: `main` or `master`).\n  - `--code`: Open in VS Code after creation.\n  - `--cursor`: Open in Cursor after creation.\n  - `--cd`: After creation, go to the directory where the corresponding work tree exists.\n\n- **Automatic file copying:**\n  - When `copy_ignored_files` is enabled in the config, gitignored files (like `.env` files) will be automatically copied from the main worktree to the new worktree.\n  - This is useful for development environment files that need to be present but shouldn't be tracked by Git.\n\n---\n\n### `gwm go [query]`\n\nFind a worktree and jump into it (launches a subshell).\n\n- Run `gwm go` for interactive selection or supply an initial query, e.g., `gwm go feat`.\n- **Key options:**\n  - `--code`, `-c`: Open the selected worktree in Visual Studio Code.\n  - `--cursor`: Open the selected worktree in Cursor.\n\n---\n\n### `gwm remove [query]` (alias: `rm`)\n\nInteractively select and delete one or more worktrees.\n\n- Run `gwm remove` to choose from a list and delete.\n- **Key options:**\n  - `-f, --force`: Delete even if there are uncommitted changes.\n  - `--clean-branch \u003cmode\u003e`: Decide whether to delete the local branch along with the worktree (`auto` / `ask` / `never`).\n\n---\n\n### `gwm clean`\n\nAutomatically detect and clean up worktrees that are safe to delete.\n\nA worktree is eligible if:\n\n1. The remote branch has been deleted or merged into the main branch\n2. There are no local changes (uncommitted or unpushed commits)\n3. It is not the main branch or the worktree you're currently in\n\n- **Key options:**\n  - `-n, --dry-run`: Show the list only; don't delete.\n  - `--force`: Skip confirmation and delete immediately.\n\n---\n\n### `gwm pull-main`\n\nRegardless of where you are, find worktrees of main branches (`main`, `master`, etc.) and run `git pull` to bring them up to date.\n\n## 🔄 Workflow Comparison\n\n### Before gwm (Traditional Git)\n\n```bash\n# Reviewing a PR\ngit stash                    # Save current work\ngit checkout main           # Switch to main\ngit pull                    # Update main\ngit checkout pr-branch      # Switch to PR branch\ngit pull origin pr-branch   # Update PR branch\n# ... review work ...\ngit checkout main           # Back to main\ngit stash pop               # Restore work\n```\n\n### After gwm\n\n```bash\n# Reviewing a PR\ngwm add pr-branch -r        # Create worktree from remote\ngwm go pr-branch           # Jump to review\n# ... review work ... (your main work is untouched)\ngwm remove pr-branch       # Clean up when done\n```\n\n## 🛠️ Troubleshooting\n\n### Getting Help\n\n- Run `gwm help` for general help\n- Run `gwm help \u003ccommand\u003e` for specific command help\n- Check the [GitHub Issues](https://github.com/shutootaki/gwm/issues) for known problems\n- Create a new issue if you encounter a bug\n\n## 📄 License\n\nMIT © 2024 Shuto Otaki and contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshutootaki%2Fgwm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshutootaki%2Fgwm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshutootaki%2Fgwm/lists"}