Aviator-inspired CLI tool for managing stacked git branches, built with TypeScript and Node.js.
Stacked branches allow you to create multiple dependent feature branches that build on top of each other, similar to how Aviator or other modern development workflows work. Instead of waiting for one PR to be merged before starting the next, you can stack multiple branches and manage them as a cohesive unit.
For example:
main→feature-auth→feature-auth-ui→feature-auth-tests
When you make changes to feature-auth, this tool can automatically propagate those changes up the stack to feature-auth-ui and feature-auth-tests.
- Dynamic Branch Stacking: Metadata stored in
.git/config, no hardcoded branches - Aviator-style Commands: Clean, intuitive API inspired by aviator library
- Smart Git Operations: Uses simple-git for reliable git operations
- Automatic PR Creation: Works with GitHub CLI (gh) and GitLab CLI (glab)
- Stack Updates: Rebase entire stacks with conflict detection
- Status Display: Rich status view with sync information
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Make executable (already done)
chmod +x dist/cli.js# Build the project
pnpm install
pnpm run build
# Initialize your first stack (set main as the trunk branch)
sb init main
# Create your first stacked branch
sb branch feature-auth
# Make some changes and commit
sb commit -m "Add basic authentication"
# Create a second branch stacked on the first
sb branch feature-auth-ui
# Make changes and commit
sb commit -m "Add login UI"
# View your stack
sb status
# Update the entire stack (rebase all branches)
sb stack
# Push all branches
sb push --all
# Create pull requests for all branches
sb pr --all| Command | Aliases | Description |
|---|---|---|
init [branch] <parent> |
Set parent branch relationship in git config | |
branch <name> |
b |
Create new branch stacked on current branch |
commit [options] |
c |
Commit changes, optionally create branch |
push [options] [branch] |
p |
Push branches to remote |
pr [options] [branch] |
Create pull requests using GitHub CLI (gh) or GitLab CLI (glab) | |
stack [branch] |
s |
Update stack via rebasing (propagate changes up the stack) |
status |
st |
Show stack status with sync info |
test |
t |
Run tests on current branch |
| Option | Commands | Description |
|---|---|---|
--fetch |
All | Fetch from remote before operations |
-b, --branch |
commit |
Create new branch from commit message |
-m, --message <msg> |
commit |
Commit message (required) |
--all |
push, pr |
Apply to all branches in stack |
--current |
push, pr |
Apply to current branch only |
# Start from main branch
git checkout main
# Initialize the stack
sb init main
# Create first feature branch
sb branch feature-auth
echo "auth logic" > auth.js
sb commit -m "Add authentication logic"
# Create second branch stacked on first
sb branch feature-auth-ui
echo "login form" > login.html
sb commit -m "Add login UI"
# View the stack
sb status# Go back to the first branch
git checkout feature-auth
# Make changes
echo "improved auth" >> auth.js
sb commit -m "Improve authentication"
# Propagate changes up the stack
sb stack
# This will rebase feature-auth-ui on top of the updated feature-auth# Install dependencies
pnpm install
# Run in development mode
pnpm run dev
# Build
pnpm run build
# Lint
pnpm run lint
# Type check
pnpm run typecheck
# Run tests with Vitest
pnpm run test- Node.js >= 16.0.0
- Git repository
- GitHub CLI (gh) or GitLab CLI (glab) for PR creation
- TypeScript: Full type safety and modern JavaScript features
- simple-git: Reliable git operations without native dependencies
- commander: Clean CLI interface
- chalk: Colored terminal output
- Modular Design: Separated concerns for maintainability
This TypeScript rewrite provides the same functionality as the original bash script with:
- Better error handling and type safety
- Cleaner, more maintainable codebase
- Enhanced testing capabilities
- Cross-platform compatibility
- Improved developer experience