{"id":36486744,"url":"https://github.com/stefanaki/stk","last_synced_at":"2026-01-15T02:14:23.414Z","repository":{"id":331999903,"uuid":"1127504482","full_name":"stefanaki/stk","owner":"stefanaki","description":"A command-line tool for managing stacked branches (stacked diffs) in Git.","archived":false,"fork":false,"pushed_at":"2026-01-08T03:28:01.000Z","size":6500,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T03:37:10.578Z","etag":null,"topics":["cli","git","pull-requests","stacked-diffs"],"latest_commit_sha":null,"homepage":"","language":"Go","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/stefanaki.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-04T02:44:00.000Z","updated_at":"2026-01-08T03:28:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/stefanaki/stk","commit_stats":null,"previous_names":["stefanaki/stk"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/stefanaki/stk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanaki%2Fstk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanaki%2Fstk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanaki%2Fstk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanaki%2Fstk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanaki","download_url":"https://codeload.github.com/stefanaki/stk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanaki%2Fstk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"online","status_checked_at":"2026-01-15T02:00:08.019Z","response_time":62,"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":["cli","git","pull-requests","stacked-diffs"],"created_at":"2026-01-12T01:52:00.984Z","updated_at":"2026-01-15T02:14:23.409Z","avatar_url":"https://github.com/stefanaki.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stk - Stacked Branches CLI\n\nA command-line tool for managing stacked branches (stacked diffs) in Git.\n\n## What are Stacked Branches?\n\nStacked branches are a workflow where you create a chain of dependent branches, each building on top of the previous one. This is useful for:\n\n- Breaking large features into smaller, reviewable PRs\n- Keeping dependent changes in sync during development\n- Parallel code review of related changes\n\n```\nmain\n └── feature/auth-models     ← PR #1: Data models\n      └── feature/auth-api   ← PR #2: API endpoints (depends on #1)\n           └── feature/auth-ui ← PR #3: UI components (depends on #2)\n```\n\n## Installation\n\n```bash\n# From source\ngo install github.com/stefanaki/stk/cmd/stk@latest\n\n# Or clone and build\ngit clone https://github.com/stefanaki/stk\ncd stk\nmake install\n```\n\n## Quick Start\n\n```bash\n# Initialize a stack on your current branch\nstk init my-feature --base main\n\n# Create branches as you work\nstk branch auth-models\n# ... make changes, commit ...\n\nstk branch auth-api\n# ... make changes, commit ...\n\nstk branch auth-ui\n# ... make changes, commit ...\n\n# See your stack\nstk status\n\n# Sync with remote (fetch, update base, rebase stack)\nstk sync\n\n# Push all branches and create/update PRs\nstk submit\n```\n\n## Commands\n\n### Stack Management\n\n| Command | Description |\n|---------|-------------|\n| `stk init \u003cname\u003e` | Initialize a new stack |\n| `stk status` | Show current stack status |\n| `stk list` | List all stacks |\n| `stk switch \u003cname\u003e` | Switch to a different stack |\n| `stk delete \u003cname\u003e` | Delete a stack |\n| `stk rename \u003cold\u003e \u003cnew\u003e` | Rename a stack |\n| `stk doctor` | Validate stack integrity |\n| `stk log` | Show stack as a tree |\n\n### Branch Operations\n\n| Command | Description |\n|---------|-------------|\n| `stk branch \u003cname\u003e` | Create a new branch and add to stack |\n| `stk add \u003cbranch\u003e` | Add existing branch to stack |\n| `stk remove \u003cbranch\u003e` | Remove branch from stack |\n| `stk move \u003cbranch\u003e --after \u003cother\u003e` | Reorder branch in stack |\n\n### Navigation\n\n| Command | Description |\n|---------|-------------|\n| `stk up` | Checkout parent branch |\n| `stk down` | Checkout child branch |\n| `stk top` | Checkout base branch |\n| `stk bottom` | Checkout last branch |\n| `stk goto \u003cn\u003e` | Checkout nth branch |\n| `stk which` | Show current position |\n\n### Sync \u0026 Submit\n\n| Command | Description |\n|---------|-------------|\n| `stk sync` | Fetch, refresh PR states, cleanup merged/closed, rebase |\n| `stk sync --no-fetch` | Local rebase only (skip fetching) |\n| `stk sync --no-rebase` | Only refresh PR states, don't rebase |\n| `stk sync --delete-merged` | Delete local branches for merged PRs |\n| `stk submit` | Push all branches, create/update PRs |\n| `stk submit --draft` | Create new PRs as drafts |\n| `stk submit --no-create-prs` | Push only, don't create new PRs |\n| `stk submit --no-update-prs` | Don't update existing PR descriptions |\n| `stk edit [branch]` | Interactive rebase within a branch |\n\n### Pull Requests\n\n| Command | Description |\n|---------|-------------|\n| `stk pr status` | Show PR status for all branches |\n| `stk pr status --refresh` | Refresh PR status from remote |\n| `stk pr view [branch]` | Open PR in browser |\n| `stk pr create [branch]` | Manual PR creation (usually use `stk submit` instead) |\n| `stk pr update [branch]` | Manual PR description update |\n\n\u003e **Note:** PR merging and closing should be done via GitHub/GitLab UI.\n\u003e When you run `stk sync`, it automatically detects merged/closed PRs and updates the stack accordingly.\n\n### Workflow\n\nThe CLI follows a **sync → submit** workflow:\n\n**`stk sync`** (remote → local):\n1. Fetch updates from origin\n2. Update base branch (pull --rebase)\n3. Refresh PR states from remote\n4. Process merged PRs (remove from stack, retarget downstream PRs)\n5. Process closed PRs (clear metadata, will recreate on submit)\n6. Rebase entire stack onto updated base\n\n**`stk submit`** (local → remote):\n1. Check if base branch is synced with remote\n2. Push all branches (--force-with-lease)\n3. Create PRs for branches without one\n4. Update all PR descriptions with current stack status\n\nEach PR description includes a \"Stack\" section showing:\n- All branches in the stack\n- PR numbers and links\n- Current status of each PR\n- Which PR you're currently viewing\n\nExample PR description:\n\n```markdown\n## 📚 Stack\n\nThis PR is part of the **my-feature** stack:\n\n| # | Branch | PR | Status |\n|---|--------|-----|--------|\n| 1 | `feature/auth-models` | #142 | ✅ Merged |\n| **2** | **`feature/auth-api`** | **#143** | **🔄 This PR** |\n| 3 | `feature/auth-ui` | #144 | 📝 Draft |\n\n---\n*Managed by [stk](https://github.com/stefanaki/stk)*\n```\n\n## Atomic Rebases\n\nThe rebase during `stk sync` is atomic - if any rebase fails (e.g., due to conflicts), all branches are automatically rolled back to their original state.\n\n```\n📸 Saving branch positions for rollback...\n\n▶ Rebasing feature/auth-models onto main\n▶ Rebasing feature/auth-api onto feature/auth-models\n\n❌ Rebase failed.\n\n⏪ Rolling back all branches...\n  Resetting feature/auth-models to e5f6g7h8\n  Resetting feature/auth-api to i9j0k1l2\n\n✅ Rollback complete - stack restored to original state\n```\n\nAfter resolving conflicts manually, use `stk sync --no-fetch` to retry the rebase.\n\n## Stack Storage\n\nStacks are stored in `.git/stacks/\u003cname\u003e.yaml`:\n\n```yaml\nversion: 1\nname: my-feature\nbase: main\ncreated: 2026-01-04T10:30:00Z\nupdated: 2026-01-04T14:22:00Z\nbranches:\n  - name: feature/auth-models\n    pr:\n      number: 142\n      url: https://github.com/org/repo/pull/142\n      state: open\n  - name: feature/auth-api\n    pr:\n      number: 143\n      url: https://github.com/org/repo/pull/143\n      state: open\n```\n\n## Shell Completion\n\n```bash\n# Bash\nstk completion bash \u003e /etc/bash_completion.d/stk\n\n# Zsh\nstk completion zsh \u003e \"${fpath[1]}/_stk\"\n\n# Fish\nstk completion fish \u003e ~/.config/fish/completions/stk.fish\n```\n\n## Requirements\n\n- Git 2.0+\n- Go 1.21+ (for building from source)\n- GitHub CLI (`gh`) for PR operations (optional, can use `GITHUB_TOKEN` instead)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanaki%2Fstk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanaki%2Fstk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanaki%2Fstk/lists"}