Skip to content

Daily Workflows

Common tasks you'll perform regularly when working with stacked changes.

Updating After Code Review

When you receive feedback on a branch in the middle of your stack:

  1. Navigate to that branch:

    stackit checkout <branch>
    

  2. Make your changes and amend:

    stackit modify
    

  3. Update all child branches:

    stackit restack
    

  4. Update the PRs:

    stackit submit
    

Using Absorb for Multi-Branch Fixes

stackit absorb is like magic for stacked PRs. If you have small fixes for multiple branches in your stack, just stage them all and run absorb.

Example scenario: You notice a typo in add-api and a bug in add-logic:

# Make fixes to multiple files
git add internal/api.go internal/logic.go

# Intelligently amend to the correct branches
stackit absorb

Stackit figures out which changes belong to which branch and amends them automatically.

Syncing with the Main Branch

To keep your stack up-to-date with main:

stackit sync

This command:

  1. Pulls the latest changes from main
  2. Deletes branches that have already been merged
  3. Restacks your remaining branches on top of the new main

Tip

Run stackit sync regularly to stay current with trunk.

Flattening a Stack

After landing PRs from the middle of a stack, use stackit flatten to move branches closer to trunk:

stackit flatten

This analyzes each branch and tests whether it can be rebased directly onto trunk (or closer to it). Branches that depend on changes from their parent will stay in place.

Before Flattening

● feature-c
│
◯ feature-b (merged)
│
◯ feature-a (merged)
│
main

After Flattening

● feature-c
│
main

Working on Multiple Stacks

To work on separate features simultaneously, each in their own directory:

# Create a new stack with its own worktree
stackit create my-feature -m "feat: start new feature" -w

This creates:

  • A new branch my-feature tracked by stackit
  • A worktree at ../your-repo-stacks/my-feature/

Navigate to the worktree:

# With shell integration: auto-changes directory
stackit worktree open my-feature

# Without shell integration: use command substitution
cd $(stackit worktree open my-feature)

See the Worktrees Guide for comprehensive documentation.

Next Steps