{"id":50354280,"url":"https://github.com/gregorriegler/yak-n-stack","last_synced_at":"2026-05-29T22:01:27.390Z","repository":{"id":349827274,"uuid":"1203198303","full_name":"gregorriegler/yak-n-stack","owner":"gregorriegler","description":"Git commands for yak-shaving and stacking PRs.","archived":false,"fork":false,"pushed_at":"2026-05-10T20:01:51.000Z","size":96,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-10T20:13:12.077Z","etag":null,"topics":["git","skill","yak-shaving"],"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/gregorriegler.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-04-06T20:21:17.000Z","updated_at":"2026-05-10T20:01:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gregorriegler/yak-n-stack","commit_stats":null,"previous_names":["gregorriegler/yak-n-stack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregorriegler/yak-n-stack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorriegler%2Fyak-n-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorriegler%2Fyak-n-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorriegler%2Fyak-n-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorriegler%2Fyak-n-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregorriegler","download_url":"https://codeload.github.com/gregorriegler/yak-n-stack/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorriegler%2Fyak-n-stack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33672125,"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-05-29T02:00:06.066Z","response_time":107,"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","skill","yak-shaving"],"created_at":"2026-05-29T22:01:26.528Z","updated_at":"2026-05-29T22:01:27.378Z","avatar_url":"https://github.com/gregorriegler.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yak-n-stack\n\n![Build](https://img.shields.io/github/actions/workflow/status/gregorriegler/yak-n-stack/coverage.yml?branch=main\u0026label=build)\n![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/gregorriegler/yak-n-stack/badges/coverage.json)\n\nGit commands for yak-shaving and stacking PRs.\n\n```\ngit yak \u003cname\u003e          pause to do something small without leaving your branch\ngit yak --branch \u003cname\u003e insert a branch beneath your current work\ngit stack \u003cname\u003e        stack a new branch on top of the current one\ngit stack-pr \u003ctitle\u003e    push and create a PR for the bottom branch\ngit sync                rebase the stack, cleaning up merged branches\ngit stack-tree          print the branch stack\n```\n\n## Install\n\n```bash\n./install.sh            # symlinks into ~/.local/bin (default)\n./install.sh --copy     # copies instead of symlinking\n./install.sh --uninstall\n```\n\n---\n\n## Yak: pause for something small\n\nYou're mid-flow on `feature` and notice a typo. You don't want to start\na new branch for a one-line fix.\n\n```bash\ngit yak typo-fix\n# fix the typo, commit it\ngit yak --done\n```\n\n`git yak \u003cname\u003e` stashes your in-progress work and leaves you on the\ncurrent branch. You make the fix and commit it directly. `git yak --done`\npops the stash back. Yak commits land on the current branch and ship with it.\n\nNest as deep as you want — each `--done` unwinds one level. Use\n`git yak --abort` instead to throw the yak away (commits discarded,\nstash dropped).\n\n---\n\n## Yak --branch: when the yak deserves its own PR\n\nIf the yak grows beyond a quick fix and you want it reviewed and\nmerged on its own:\n\nBefore:\n```\nmain\n └─ feature         ← you are here, mid-work\n```\n\n```bash\ngit yak --branch refactor\n```\n\nAfter:\n```\nmain\n └─ refactor        ← you are here, do the refactor\n     └─ feature     ← moved on top, waiting\n```\n\nThe script stashes uncommitted changes, creates `refactor` directly\nbeneath `feature`, rebases `feature` onto it, and drops you on\n`refactor`. When done:\n\n```bash\ngit yak --done\n```\n\n```\nmain\n └─ refactor        ← ready for review\n     └─ feature     ← you are back here, stash restored\n```\n\n---\n\n## Stack: keep going without waiting\n\nYou finished `part-1` and want to keep building on top.\n\nBefore:\n```\nmain\n └─ part-1          ← you are here, done but not merged\n```\n\nMotivation: `part-1` is in review. You don't want to wait — you want to\nstart `part-2` on top, so it's ready the moment `part-1` lands.\n\n```bash\ngit stack part-2\n```\n\nAfter:\n```\nmain\n └─ part-1\n     └─ part-2      ← you are here\n```\n\n---\n\n## Stack-pr: open a PR for the bottom branch\n\nYou're ready to send the bottom branch for review.\n\nBefore:\n```\nmain\n └─ part-1\n     └─ part-2      ← you are here\n```\n\nMotivation: only the bottom branch can be merged next. `stack-pr` finds\nit and opens the PR against main — no checkout needed.\n\n```bash\ngit stack-pr \"Add feature part 1\"\n```\n\nAfter: `part-1` is pushed and a PR is open against main. You stay on\n`part-2` and keep working.\n\n---\n\n## Sync: a PR was merged\n\nPR #1 (`part-1`) gets merged.\n\nBefore:\n```\nmain\n └─ part-1          ← merged\n     └─ part-2      ← you are here\n```\n\nMotivation: main moved forward. The stack needs to be rebased onto the\nnew main, and the merged branch cleaned up.\n\n```bash\ngit sync\n```\n\nAfter:\n```\nmain                ← includes part-1\n └─ part-2          ← rebased onto new main (you are here)\n```\n\n`git sync` detects that `part-1` was merged, deletes it, and rebases\neverything above onto the new main. Works with squash merges,\nrebase-and-merge, and regular merge commits.\n\n---\n\n## How it works\n\nBranch relationships are stored in git config as `branch.\u003cname\u003e.stack-parent`.\n`git stack-tree` prints the current stack:\n\n```bash\n$ git stack-tree\nmain\n └─ refactor [2]\n     └─ feature [3] ←\n```\n\nThe `[N]` is the commit count. The `←` marks the current branch.\nAll commands print the tree after completing, so you always know where\nyou are.\n\n## Tests\n\n```bash\n./test.sh\n```\n\n## Notes\n\n- `git stack-pr` requires the [GitHub CLI](https://cli.github.com/) (`gh`).\n- The scripts assume your remote is named `origin`.\n- If `init.defaultBranch` is not set, the scripts default to `main`:\n  ```bash\n  git config init.defaultBranch develop   # if your trunk is different\n  ```\n- If you rename or delete branches outside these commands, the\n  `stack-parent` config can go stale. Clean it up with\n  `git config --remove-section branch.\u003cname\u003e`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorriegler%2Fyak-n-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregorriegler%2Fyak-n-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorriegler%2Fyak-n-stack/lists"}