gt restack¶
Rebase branches onto their updated parents.
Usage¶
Options¶
| Option | Description |
|---|---|
--dry-run |
Show what would happen without making changes |
Examples¶
Restack All Branches¶
Preview Changes¶
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¶
- Identifies branches that need rebasing
- Rebases each branch onto its parent in topological order
- Reports success or conflicts
Handling Conflicts¶
If conflicts occur:
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.
Related Commands¶
gt sync- Fetch and restackgt modify- Amend commitsgt continue- Continue after conflicts