Stacked diffs
- Tier: Core, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
- Status: Experiment
In the GitLab CLI, stacked diffs are a way of creating small changes that build upon each other to ultimately deliver a feature. Each stack is separate, so you can keep building your feature in one stack while previous parts of the stack receive reviews and updates.
The base command for this feature in the CLI is
stack
, which
you then extend with other commands.
This feature is an experiment. We’d love to hear your feedback in issue 7473.
Create a stacked diff
To do create a stacked diff in the GitLab CLI:
- In your terminal window, create a new stack with
glab stack create
, and give your stack a name. - Make your first set of changes.
- To save your first set of changes, enter
glab stack save
, then a commit message. - Continue creating changes, saving them with
glab stack save
. Each time you save a stack,glab
creates a new branch. - To push your changes up to GitLab, enter
glab stack sync
. GitLab creates a merge request for each stack.
Commands that build upon glab stack
Use these sub-commands with glab stack
:
Add changes to a diff in a stack
To return to a specific point in the stack to add more changes to it:
- In your terminal window, use the
glab stack move
command.glab
displays a list of stacks. - Select the stack you want to edit, and make your changes.
- When you’re ready to save your changes, use the
glab stack amend
command. - Optional. Change the description of the stack, if desired.
- Run
glab stack sync
to push your changes back up to GitLab.
When you sync an existing stack, GitLab:
- Updates the existing stack with your new changes.
- Rebases the other merge requests in the stack to bring in your latest changes.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support