{"id":31581158,"url":"https://github.com/lucasmodrich/git-worktree-manager","last_synced_at":"2026-02-21T05:04:11.780Z","repository":{"id":315152276,"uuid":"1056940331","full_name":"lucasmodrich/git-worktree-manager","owner":"lucasmodrich","description":"A flexible Bash shell script for managing Git repositories using a bare clone + worktree workflow.","archived":false,"fork":false,"pushed_at":"2025-10-01T00:02:32.000Z","size":158,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-01T02:29:03.473Z","etag":null,"topics":["bash","bash-script","git","github","management","repository","script","worktree"],"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/lucasmodrich.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-09-15T04:12:39.000Z","updated_at":"2025-09-18T04:18:38.000Z","dependencies_parsed_at":"2025-09-17T02:00:54.801Z","dependency_job_id":"4b56ff83-cc1f-4032-9fa3-446b3eb636cc","html_url":"https://github.com/lucasmodrich/git-worktree-manager","commit_stats":null,"previous_names":["lucasmodrich/git-worktree-manager"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/lucasmodrich/git-worktree-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasmodrich%2Fgit-worktree-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasmodrich%2Fgit-worktree-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasmodrich%2Fgit-worktree-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasmodrich%2Fgit-worktree-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucasmodrich","download_url":"https://codeload.github.com/lucasmodrich/git-worktree-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasmodrich%2Fgit-worktree-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278526243,"owners_count":26001325,"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-10-05T02:00:06.059Z","response_time":54,"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":["bash","bash-script","git","github","management","repository","script","worktree"],"created_at":"2025-10-05T21:54:03.390Z","updated_at":"2026-02-21T05:04:11.773Z","avatar_url":"https://github.com/lucasmodrich.png","language":"Shell","readme":"# Git Worktree Manager (`gwtm`)\n\n## 📌 Overview\n\n`gwtm` is a CLI tool for managing Git repositories using a **bare clone + worktree** workflow. It removes the friction of multi-branch development by giving each branch its own dedicated working directory — no stashing, no switching, no detached HEADs.\n\nFeatures:\n- **Full setup** from GitHub using `org/repo` shorthand\n- **Branch creation** with automatic remote push\n- **Worktree listing**, pruning, and removal with optional remote cleanup\n- **Self-upgrade** with checksum verification\n- **Dry-run mode** to preview any operation before executing it\n- **Configurable installation** directory via environment variable\n- Works from **any subdirectory** within a managed repository\n\n---\n\n## 🚀 Installation\n\n### Download Pre-built Binary (Recommended)\n\n```bash\n# Linux amd64\ncurl -L https://github.com/lucasmodrich/git-worktree-manager/releases/latest/download/gwtm_Linux_x86_64 -o gwtm\nchmod +x gwtm\nsudo mv gwtm /usr/local/bin/\n\n# macOS Apple Silicon (M1/M2/M3)\ncurl -L https://github.com/lucasmodrich/git-worktree-manager/releases/latest/download/gwtm_Darwin_arm64 -o gwtm\nchmod +x gwtm\nsudo mv gwtm /usr/local/bin/\n\n# macOS Intel\ncurl -L https://github.com/lucasmodrich/git-worktree-manager/releases/latest/download/gwtm_Darwin_x86_64 -o gwtm\nchmod +x gwtm\nsudo mv gwtm /usr/local/bin/\n\n# Windows (PowerShell)\n# Download gwtm_Windows_x86_64.exe from the releases page, rename to gwtm.exe, and add to PATH\n```\n\n### Build from Source\n\nRequires Go 1.25.1 or later.\n\n```bash\ngit clone https://github.com/lucasmodrich/git-worktree-manager.git\ncd git-worktree-manager\ngo build -o gwtm ./cmd/git-worktree-manager\n# Move the binary somewhere on your PATH, e.g.:\nsudo mv gwtm /usr/local/bin/\n```\n\n### Self-Upgrade\n\n```bash\ngwtm upgrade\n```\n\n---\n\n## 📂 Repository Structure\n\nAfter running `gwtm setup`, the following structure is created:\n\n```\n\u003crepo-name\u003e/\n├── .bare/             # Bare repository clone (Git objects \u0026 metadata)\n├── .git               # File pointing to .bare\n└── \u003cdefault-branch\u003e/  # Initial worktree, ready to work in\n```\n\nAdditional worktrees are added as sibling directories:\n\n```\n\u003crepo-name\u003e/\n├── .bare/\n├── .git\n├── main/\n├── feature-auth/\n└── bugfix-crash/\n```\n\n---\n\n## 🖼 Architecture\n\n```\n                ┌───────────────────────────┐\n                │        .bare repo         │\n                │  (Git metadata \u0026 objects) │\n                └─────────────┬─────────────┘\n                              │\n     ┌────────────────────────┼────────────────────────┐\n     │                        │                        │\n┌──────────────┐       ┌──────────────┐        ┌──────────────┐\n│ main/        │       │ feature-auth/│        │ bugfix-crash/│\n│ (worktree)   │       │ (worktree)   │        │ (worktree)   │\n└──────────────┘       └──────────────┘        └──────────────┘\n```\n\n---\n\n## 🚀 Usage\n\n### Help\n\n```bash\ngwtm --help\ngwtm \u003ccommand\u003e --help\n```\n\n### Full Setup\n\nClone a repository and create the initial worktree in one step:\n\n```bash\ngwtm setup your-org/your-repo\n# also accepts full SSH URL:\ngwtm setup git@github.com:your-org/your-repo.git\n```\n\n### Create a Branch Worktree\n\nCreates a new branch (or checks out an existing one) and adds a worktree for it. Use hyphens in branch names — slashes are not supported as they conflict with directory paths.\n\n```bash\n# New branch from the default branch\ngwtm new-branch feature-login\n\n# New branch from a specific base\ngwtm new-branch bugfix-crash main\n\n# Check out an existing remote branch\ngwtm new-branch feature-login    # detects it exists on remote and prompts\n```\n\n### Remove a Worktree and Branch\n\n```bash\n# Remove worktree and local branch\ngwtm remove feature-login\n\n# Remove worktree, local branch, and remote branch\ngwtm remove feature-login --remote\n```\n\n### List Worktrees\n\n```bash\ngwtm list\n```\n\n### Prune Stale Worktrees\n\n```bash\ngwtm prune\n```\n\n### Version\n\n```bash\ngwtm version      # shows local version and checks for updates\ngwtm --version    # quick version output (no network check)\n```\n\n### Upgrade\n\n```bash\ngwtm upgrade\n```\n\n### Dry-Run Mode\n\nPreview any operation without executing it:\n\n```bash\ngwtm --dry-run setup acme/webapp\ngwtm --dry-run new-branch feature-payments\ngwtm --dry-run remove feature-payments --remote\n```\n\n---\n\n## 📖 Example Workflows\n\n### Start a new feature\n\n```bash\n# Set up the repository (once)\ngwtm setup acme/webapp\ncd acme/webapp\n\n# Create a feature branch and worktree\ngwtm new-branch feature-login\ncd feature-login\n\n# Do your work\ngit add .\ngit commit -m \"feat: add login page\"\ngit push\n\n# When done, go back up and clean up\ncd ..\ngwtm remove feature-login --remote\n```\n\n### Pick up a colleague's branch\n\n```bash\ncd acme/webapp\ngwtm new-branch feature-payments   # detects remote branch, prompts to check out\ncd feature-payments\n```\n\n### Preview before acting\n\n```bash\ngwtm --dry-run setup acme/webapp\ngwtm --dry-run remove old-branch --remote\n```\n\n---\n\n## 🔧 Configuration\n\n### Environment Variables\n\n| Variable | Default | Description |\n|---|---|---|\n| `GIT_WORKTREE_MANAGER_HOME` | `$HOME/.git-worktree-manager` | Installation directory for `gwtm upgrade` |\n\n### Git Alias (optional)\n\n```ini\n# ~/.gitconfig\n[alias]\n    wt = \"!gwtm\"\n```\n\nThen use: `git wt list`, `git wt new-branch feature-x`, etc.\n\n---\n\n## 🧪 Testing\n\n```bash\n# Run Go tests\ngo test ./...\n\n# Run with coverage\ngo test -coverprofile=coverage.txt ./...\ngo tool cover -html=coverage.txt\n```\n\n---\n\n## 🔒 Security \u0026 Reliability\n\n- **Input validation**: Repository formats are validated; branch names with path separators are rejected\n- **Checksum verification**: `gwtm upgrade` verifies SHA-256 checksums before replacing the binary\n- **Atomic upgrades**: New binary downloaded to a temp file and moved into place only after verification\n- **Dry-run mode**: Preview any destructive operation before executing it\n- **Cleanup on failure**: `gwtm setup` removes the partial directory if any step fails\n\n---\n\n## ✅ Benefits\n\n- **Disk-efficient** multi-branch development — shared object store, no redundant copies\n- **No detached HEADs** — each branch has its own working directory\n- **No stashing** — switch contexts by changing directories\n- **Cross-platform** — runs on Linux, macOS, and Windows\n- **Self-updating** with version comparison and checksum verification\n\n---\n\n## 🛠 Requirements\n\n- **Git 2.5+** (worktree support)\n- **SSH access** to GitHub (recommended) or HTTPS\n\nThe `gwtm` binary is statically compiled with no additional runtime dependencies.\n\n---\n\n## 📝 Version History\n\nSee [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasmodrich%2Fgit-worktree-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucasmodrich%2Fgit-worktree-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasmodrich%2Fgit-worktree-manager/lists"}