{"id":29136375,"url":"https://github.com/wasabeef/git-workers","last_synced_at":"2025-06-30T11:08:08.250Z","repository":{"id":300016309,"uuid":"1003101879","full_name":"wasabeef/git-workers","owner":"wasabeef","description":"An interactive CLI tool for managing Git worktrees with ease.","archived":false,"fork":false,"pushed_at":"2025-06-19T12:14:55.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-19T13:19:24.326Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/wasabeef.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":"wasabeef"}},"created_at":"2025-06-16T16:15:16.000Z","updated_at":"2025-06-19T12:10:38.000Z","dependencies_parsed_at":"2025-06-19T13:19:27.088Z","dependency_job_id":"24193788-c247-43fc-a346-01f2cb8b3e82","html_url":"https://github.com/wasabeef/git-workers","commit_stats":null,"previous_names":["wasabeef/git-workers"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wasabeef/git-workers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fgit-workers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fgit-workers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fgit-workers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fgit-workers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wasabeef","download_url":"https://codeload.github.com/wasabeef/git-workers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fgit-workers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262762466,"owners_count":23360330,"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","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":[],"created_at":"2025-06-30T11:08:07.249Z","updated_at":"2025-06-30T11:08:08.222Z","avatar_url":"https://github.com/wasabeef.png","language":"Rust","funding_links":["https://github.com/sponsors/wasabeef"],"categories":[],"sub_categories":[],"readme":"# Git Workers\n\n[![CI](https://github.com/wasabeef/git-workers/actions/workflows/ci.yml/badge.svg)](https://github.com/wasabeef/git-workers/actions/workflows/ci.yml)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nAn interactive CLI tool for managing Git worktrees with ease.\n\nhttps://github.com/user-attachments/assets/fb5f0213-4a9f-43e2-9557-416070d7e122\n\n## Features\n\n- 📋 List worktrees with detailed status information (branch, changes, ahead/behind)\n- 🔍 Fuzzy search through worktrees and branches\n- ➕ Create new worktrees from branches or HEAD\n- 📄 Automatically copy gitignored files (like .env) to new worktrees\n- ➖ Delete single or multiple worktrees\n- 🔄 Switch worktrees with automatic directory change\n- ✏️ Rename worktrees and optionally their branches\n- 🧹 Cleanup old worktrees by age\n- 🪝 Execute hooks on worktree lifecycle events\n- 📝 Edit and manage hooks through the interface\n\n## Installation\n\n### Homebrew\n\n```bash\nbrew install wasabeef/gw-tap/gw\n```\n\n### Shell Integration\n\nTo enable automatic directory switching when switching worktrees, add this to your shell config:\n\n```bash\n# For bash (~/.bashrc) or zsh (~/.zshrc)\nsource $(brew --prefix)/share/gw/shell/gw.sh\n```\n\nFor manual installation, use the path where git-workers is installed:\n\n```bash\nsource /path/to/git-workers/shell/gw.sh\n```\n\n## Usage\n\nRun `gw` in any Git repository:\n\n```bash\ngw\n```\n\n### Interactive Menu\n\nGit Workers provides an interactive menu-driven interface. Simply run `gw` and navigate through the options:\n\n- **List worktrees** (`•`): Display all worktrees with branch, changes, and sync status\n- **Search worktrees** (`?`): Fuzzy search through worktree names and branches\n- **Create worktree** (`+`): Create a new worktree with two options:\n  - **Create from current HEAD**: Creates a new worktree with a new branch from the current HEAD\n  - **Select branch (smart mode)**: Choose from local/remote branches with fuzzy search:\n    - Shows local branches (💻) and remote branches (⛅️) with usage status\n    - Automatically handles branch conflicts (offers to create new branch if already in use)\n    - Fuzzy search enabled when \u003e10 branches for easy navigation\n    - Automatically copies configured files (.env, etc.) to new worktrees\n- **Delete worktree** (`-`): Delete a single worktree with safety checks\n- **Batch delete** (`=`): Select and delete multiple worktrees at once (optionally deletes orphaned branches)\n- **Cleanup old worktrees** (`~`): Remove worktrees older than specified days\n- **Switch worktree** (`→`): Switch to another worktree (automatically changes directory)\n- **Rename worktree** (`*`): Rename worktree directory and optionally its branch\n- **Edit hooks** (`λ`): Configure lifecycle hooks in `.git-workers.toml`\n- **Exit** (`x`): Exit the application\n\n### Configuration\n\nGit Workers uses `.git-workers.toml` for configuration. The loading strategy differs between bare and non-bare repositories:\n\n#### Bare Repositories\n\nFor bare repositories (e.g., `repo.git`), configuration is loaded from:\n\n1. Current directory\n2. Default branch directory in current directory (e.g., `./main/.git-workers.toml`)\n3. Detected worktree pattern (automatically finds where existing worktrees are organized)\n4. Common subdirectories (`branch/`, `worktrees/`)\n\n#### Non-bare Repositories\n\nFor regular repositories, configuration is loaded from:\n\n1. Current directory\n2. Main repository directory (where `.git` is a directory)\n3. Parent directories' `main/` or `master/` subdirectories\n\n```toml\n[repository]\n# Optional: Specify repository URL to ensure hooks only run in the intended repository\n# url = \"https://github.com/owner/repo.git\"\n\n[repository]\n# Repository URL for identification (optional)\n# This ensures hooks only run in the intended repository\nurl = \"https://github.com/wasabeef/git-workers.git\"\n\n[hooks]\n# Run after creating a new worktree\npost-create = [\n    \"echo '🤖 Created worktree: {{worktree_name}}'\",\n    \"echo '🤖 Path: {{worktree_path}}'\"\n]\n\n# Run before removing a worktree\npre-remove = [\n    \"echo '🤖 Removing worktree: {{worktree_name}}'\"\n]\n\n# Run after switching to a worktree\npost-switch = [\n    \"echo '🤖 Switched to: {{worktree_name}}'\"\n]\n\n[files]\n# Optional: Specify a custom source directory\n# If not specified, automatically finds the main worktree\n# source = \"/path/to/custom/source\"\n# source = \"./templates\"  # Relative to repository root\n\n# Files to copy when creating new worktrees\n# These are typically gitignored files needed for development\ncopy = [\n    \".env\",\n    \".env.local\"\n]\n```\n\n### Hook Variables\n\n- `{{worktree_name}}`: The name of the worktree\n- `{{worktree_path}}`: The absolute path to the worktree\n\n### Worktree Patterns\n\nWhen creating your first worktree, Git Workers offers two patterns:\n\n1. **Same level as repository**: Creates worktrees as siblings to your main repository\n\n   ```\n   parent/\n   ├── my-repo/\n   ├── feature-1/\n   └── feature-2/\n   ```\n\n2. **In subdirectory** (recommended): Organizes worktrees in a dedicated directory\n   ```\n   parent/\n   └── my-repo/\n       └── worktrees/\n           ├── feature-1/\n           └── feature-2/\n   ```\n\nYou can also create worktrees with custom paths:\n\n- `../feature`: Creates at the same level as the repository\n- `worktrees/feature`: Creates in a subdirectory\n- `branch/feature`: Creates in a custom subdirectory structure\n\n### Keyboard Shortcuts\n\n- **ESC**: Cancel current operation and return to menu\n- **Ctrl+C**: Exit the application\n- **Ctrl+U**: Clear input line\n- **Ctrl+W**: Delete word before cursor\n- **Arrow Keys**: Navigate menus\n- **Enter**: Confirm selection\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Built with [git2](https://github.com/rust-lang/git2-rs) for Git operations\n- Uses [dialoguer](https://github.com/console-rs/dialoguer) for interactive prompts\n- Terminal styling with [colored](https://github.com/colored-rs/colored)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasabeef%2Fgit-workers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwasabeef%2Fgit-workers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasabeef%2Fgit-workers/lists"}