| name | glab-stack |
| description | Manage stacked diffs (stacked merge requests) using the glab CLI. Use this skill whenever the user wants to break a large change into a chain of smaller, dependent merge requests, or when they mention stacked diffs, stacked PRs, or stacked MRs. Trigger on phrases like "create stacked MRs", "split my changes into stacked diffs", "stack my commits", "glab stack", or any stacked diff workflow. Note: this is an experimental glab feature. |
GitLab Stacked Diff Management (Experimental)
Use glab stack to create a chain of small, dependent merge requests from a large set of changes. Each stack is an independent MR that builds on the previous one, making code review easier.
Note: This is an experimental feature. Behavior may change in future glab versions.
Workflow Overview
main
└── stack-1 (MR #1: auth changes)
└── stack-2 (MR #2: user profile changes)
└── stack-3 (MR #3: dashboard changes)
Create a New Stack
Start a new stack from the current branch:
glab stack create
Save Changes to the Current Stack
After making code changes:
glab stack save
This stages and commits changes into the current stack entry.
Amend the Current Stack
Modify the most recent stack entry:
glab stack amend
Navigate Between Stacks
glab stack next
glab stack prev
glab stack first
glab stack last
glab stack switch
List All Stacks
glab stack list
Reorder Stacks
glab stack reorder
Interactive reordering of the stack chain.
Sync to GitLab (Create / Update MRs)
glab stack sync
This pushes all stack branches and creates or updates the corresponding MRs on GitLab. Each MR targets the previous stack's branch, forming a chain.
Behavior Guidelines
- When to use stacks: Recommend stacked diffs when a feature involves multiple logical layers (e.g., database schema → API layer → frontend). It makes each layer reviewable independently.
- Sync often: Run
glab stack sync after each stack save to keep the remote MRs updated.
- Experimental caveat: Always mention that this feature is experimental and the workflow may differ from the user's expectations. Point to
glab stack --help for the latest usage.
- Base branch: The first stack in a chain targets the project's default branch (usually
main).
- Amend vs save: Use
amend to update the most recent stack without creating a new one; use save to add a new stack entry.