winget install --id=Mubbie.Stacksmith -e
Ultralight Artisan Git Stacking Tool
Stacksmith is an ultralight artisan Git stacking tool designed to manage stacked pull branches and pull requests using vanilla Git. It simplifies the process of breaking work into small, focused branches while maintaining efficient collaboration.
Key Features:
Audience & Benefit:
Ideal for developers managing complex features or long-running tasks. Stacksmith helps break work into manageable PRs, enabling continuous progress without delays. It streamlines Git operations, reduces manual errors, and enhances workflow efficiency, making it easier to maintain clean stacks for better code reviews and faster delivery.
> Ultralight Artisan Git Stacking Tool > (Forgive the corny jokes β staying on brand π§πΎβπ)
Stacksmith is your terminal blacksmithing forge for managing stacked pull branches and pull requests using vanilla Git π³
This repo contains two versions:
Version | Description | Status |
---|---|---|
stacksmith-lite.sh | πͺΆ Lightweight Bash script for fast Git stacking | β Stable |
stacksmith | β‘ Upcoming Go-powered CLI with rich UI (coming soon) | π§ In Progress |
Why Stacksmith? π€
Imagine this: you're building a big feature. It's going to touch a lot of files and introduce a lot of changes. With traditional Git workflows, your options are usually:
Both kinda suck.
Option 1 β One giant PR π±
Option 2 β Many PRs but blocked π©
Stacksmith β Many PRs. Keep shipping π
What Are Stacked PRs? π
Stacked PRs let you break work into small, focused branches β each building on top of the last.
main <- PR1 <- PR2 <- PR3 <- PR4 ...
Each PR targets the previous one, reviewers see small diffs, and you keep moving fast.
BUT managing these stacks manually with plain Git is tedious (See: , ):
That's where stacksmith
comes in.
A Go-powered version of stacksmith with an interactive CLI. It includes:
brew tap mubbie/homebrew-tap
brew install stacksmith
Or install manually
curl -LO https://github.com/mubbie/stacksmith/releases/latest/download/stacksmith_$(uname -s | tr '[:upper:]' '[:lower:]')_amd64.tar.gz
tar -xzf stacksmith_*.tar.gz
sudo mv stacksmith /usr/local/bin/
Once approved, you'll also be able to install via:
winget install Mubbie.Stacksmith
> βΉοΈ Note: Winget package is pending approval. Weβll update this once it lands.
stacksmith-lite.sh
is a zero-installation, dead-simple Bash script for managing stacked branches using vanilla Git.
It works anywhere Git works:
curl -sL https://raw.githubusercontent.com/mubbie/stacksmith/main/scripts/stacksmith-lite.sh -o stacksmith
chmod +x stacksmith
sudo mv stacksmith /usr/local/bin/
Or just alias it:
alias stacksmith='bash /path/to/stacksmith-lite.sh'
If you run into trouble adding stacksmith
to your path, here's an excellent and helpful article recommended by my friend Osaro π
stacksmith
stacksmith stack
stacksmith sync ...
stacksmith fix-pr
stacksmith push
stacksmith graph
> Prints an ASCII-style Git commit graph with branch tips and relationships.
Managing PRs with Stacksmith π
> Stacksmith helps you manage your local branches beautifully. But your PRs will still need to be created, managed, and merged manually on your Git hosting platform (Azure DevOps, GitHub, GitLab, Bitbucket, etc).
stacksmith stack
stacksmith push
stacksmith fix-pr
to rebase the next branch onto the new target (usually main
)main
stacksmith push
Use stacksmith sync
to quickly rebase and update a full stack when many PRs have merged.
Stacksmith stays simple & bashy β that's the point.
Gotchas & Pitfalls π¦
> Some common sharp edges when working with stacked PRs (and how to avoid them):
Situation | What Happens | How To Handle |
---|---|---|
PR merges out of order | Git history gets messy; later PR shows unexpected changes | Rebase your branch onto main using stacksmith fix-pr and retarget the PR |
Forgetting to retarget PR | PR shows extra unrelated commits | Always retarget PR to main (or the correct parent) after parent merges |
Not force-pushing after rebase | Remote branch gets out of sync with local | Always use stacksmith push (safe force-push) after rebasing |
Accidentally rebasing wrong parent | Changes vanish or conflict | Double-check the branch order when using stacksmith sync |
Final Rule of Thumb:
Weβre rebuilding Stacksmith in Go for a more powerful and visual CLI experience:
See the full Stacksmith Go Roadmap β‘οΈ
Contributions are welcome! β¨
Add commands, fix bugs, clean up UI, or just drop a pun. All artisan hands on deck.
Got ideas, bugs, or thoughts? Love a bad artisan pun? Open an issue or reach out!
Your feedback makes this tool better (and funnier). π
Crafted with love (and corny jokes), by artisans of the stack (mostly GPT-4o). π§πΎβπβ¨