Skip to content

gt restack

Rebase branches onto their updated parents.

Usage

gt restack [OPTIONS]

Options

Option Description
--dry-run Show what would happen without making changes

Examples

Restack All Branches

gt restack

Preview Changes

gt restack --dry-run

When to Use

Run gt restack after:

  • Modifying a commit (gt modify)
  • Squashing commits (gt squash)
  • Merging changes from trunk
  • Any time parent commits have changed

Behavior

  1. Identifies branches that need rebasing
  2. Rebases each branch onto its parent in topological order
  3. Reports success or conflicts

Handling Conflicts

If conflicts occur:

# Resolve conflicts
git add <resolved-files>

# Continue restacking
gt continue

# Or abort
gt abort

Difference from Sync

Command Fetches Remote Rebases
gt sync Yes Yes
gt restack No Yes

Use gt sync to update from remote; use gt restack for local-only rebasing.