LogoLogo
HomeAbout usSign up
  • Introduction
  • AttentionSet
    • AttentionSet Best Practices
    • How to View AttentionSet for Others
    • How to Manually Change Attention
    • AttentionSet Chrome extension
    • Attention reasons
    • AttentionSet Slack Home Page
  • Releases
    • Getting Started with Releases
    • Concepts for Releases
      • Terminology for Releases
      • Two-step delivery
      • Rollbacks
      • Cherry-picks
      • Dogfood, Canary and Rollout
      • Release notes
    • How-to Guides for Releases
      • How to Create a Release Project
      • How to Configure Environments
      • How to Create a Scheduled Release
      • Create Custom Workflow Parameters
      • How to Manage Cherry-Picks
      • How to Resolve a Cherry-Pick Failure
      • Working with your CI / CD
        • GitHub Actions workflow
        • Buildkite workflow
    • API Reference for Releases
  • FlexReview
    • Getting Started with FlexReview
    • How to Onboard a Large Org
    • Concepts for FlexReview
      • Read-Only Mode in FlexReview
      • Recursive Ownership in FlexReview
      • Reviewer suggestion and assignment
      • FlexReview Teams and SLO Management
      • Validation in FlexReview
    • How-to Guides for FlexReview
      • How to Get a Reviewer Suggestion
      • How to Exclude Reviewers
      • How to Set Up Team Rules
      • Whitelist Teams for Review Assignment
      • Troubleshoot Reviewer Assignment
      • PagerDuty Integration for Reviewers
      • How to Set Up FlexReview Validation
      • Recommended Slack Notification Settings
      • How to Exclude OOO Reviewers
    • FlexReview Reference
      • Configuration
      • Slash commands
      • Expert scoring algorithms
      • Slack Notifications
      • Out of Office User Exclusion
    • FlexReview Roadmap
  • MergeQueue
    • Getting Started with MergeQueue
    • Merge Rules
    • How-to Guides for MergeQueue
      • How to Configure Base Branches
      • How to Customize Required Checks
      • How to Set Up Fast-Forwarding
      • How to Set Up Pre-Queue Conditions
      • How to Queue / Dequeue via API
      • Pause / Unpause Queues via API
      • Slash Commands Using GitHub Comments
      • How to Customize Sticky Comments
      • Require an Aviator Status Check
      • Backport a PR
      • How to Configure ChangeSets
      • Custom Integrations
        • GitHub Integration
      • How to Create Personal Access Tokens
      • How to Set Up SAML Configuration
        • Microsoft Active Directory
      • How to Merge Stacked PRs
      • How to Block Pull Request Mergeing with Slash Commands
    • Concepts for MergeQueue
      • Queue Modes
      • Pull Request Lifecycle
      • Analytics
      • Parallel Mode
      • CI Status Requirements
      • MQ Created Branches
      • Batching
      • Managing flaky tests
      • Fast-forwarding
      • Pre-Queue Conditions
      • Sticky Comments
      • Backporting
      • Paused Queues
      • Affected Targets
        • Directory-Based Affected Targets
        • nx based affected targets
        • GitHub Actions based Affected Targets
      • ChangeSets
        • Global CI Validation
        • ChangeSets FAQs
      • Priority Merges
        • Instant Merges
      • Merge Rules Audit Trail
      • Timeline
      • Ready Hook
      • Reduce Queue Failures From Staleness
    • MergeQueue References
      • Configuration Schema
      • Configuration Reference MergeQueue
      • GitHub Slash Commands
      • Status Codes
  • Stacked PRs CLI
    • Quickstart for Stacked PRs CLI
    • CLI Installation
    • How-to Guides for Stacked PRs CLI
      • How to Create Stacked PRs in CLI
      • How to Navigate & Modify Stacked PRs
      • Add Commits in the Stack
      • How Split a Commit in CLI
      • How to Split and Fold Pull Requests
      • How to Rename a Branch in CLI
      • How to Adopt a Branch in CLI
      • Orphan a Branch with Aviator CLI
      • How to Do Git Subcommand Aliasing
      • How to Create an Access Token
      • How to Set Up Auto Completion in CLI
      • How to Use Editor Plugins in CLI
    • Concepts for StackedPRs CLI
    • How to Rebase and Sync with GitHub
    • Configuration for StackedPRs CLI
    • Stacked PRs FAQs and Troubleshooting
      • Working with Aviator CLI
      • Default Branch Update Master to Main
    • Manpages for Stacked PRs CLI
      • av(1)
      • av-adopt Command Guide
      • av-auth-status(1) in CLI
      • av-stack-branch(1) in CLI
      • av-commit-create(1) in CL
      • av-stack-diff(1) in CLI
      • av-fetch(1) in CLI
      • av-git-interaction Command Guide
      • av-init(1) in CLI
      • av-stack-next(1) in CLI
      • av-orphan Command Guide
      • av-pr-status(1) in CLI
      • av-pr-create(1) in CLI
      • av-stack-prev(1) in CLI
      • av-stack-reorder(1) in CLI
      • av-reparent Command Guide
      • av-restack Command Guide
      • av-commit-split(1) in CLI
      • av-switch Command Guide
      • av-stack-sync(1) in CLI
      • av-stack-tidy(1) in CLI
      • av-stack-tree(1) in CLI
    • Aviator CLI Major Releases
      • Aviator CLI v0.1.0 Release Notes
  • Aviator's Chrome Extension
  • Pilot Automated Actions
    • Scheduled Events
    • JavaScript Execution
    • Pilot Automated Actions Reference
      • GitHub Reference
      • MergeQueue Reference
      • Slack Reference
  • API and Integrations
    • Slack Integration Guide
    • GraphQL API Quickstart
    • Prometheus Metrics Setup for GCP
    • Reference
      • JSON API
      • GraphQL
      • Webhooks
      • Monitoring Metrics
  • Manage
    • Access Management
    • GitHub App Permissions
    • Security
      • Aviator Agents Data Usage & Retention Policy
    • On-Premise Installation
      • GitHub App for On-Prem
      • GitHub OAuth for On-Prem
      • Use Helm Instructions
      • Use Docker Compose Instructions
      • Prometheus endpoint
      • Slack Integration for On-Premise
      • Google SSO Login for On-Prem
    • FAQs
      • Troubleshooting GitHub app connection
      • MergeQueue FAQs
      • Billing FAQs
Powered by GitBook
On this page
  • Queueing action
  • Merge behavior
  • Sequential mode (default mode)
  • Parallel mode
  • Fast forwarding
  • Separating the merge commits
  • Rulesets
  • Configuring separate commits
  • Detecting stacked PRs without av CLI

Was this helpful?

  1. MergeQueue
  2. How-to Guides for MergeQueue

How to Merge Stacked PRs

Use our how-to guide for instructions on merging stacked PRs. Learn about queueing actions, core merge behaviors for stacked PRs, and separating merge commits.

PreviousMicrosoft Active DirectoryNextHow to Block Pull Request Mergeing with Slash Commands

Last updated 1 month ago

Was this helpful?

Aviator offers an for managing stacked PRs within GitHub. When used alongside Aviator MergeQueue, it simplifies the process of validating and merging those stacked PRs (or subset of those stacked PRs) together.

When requested to merge stacked PRs, Aviator will validate all the stacked PRs as if they were a single PR, and then merge them together after validation. The merge behavior may be slightly different depending on the .

Queueing action

To merge a subset of the stack, request a merge for the topmost PR in that subset. So for instance, if your stack is:

master <- PR#1 <- PR#2 <- PR#3 <- PR#4

Requesting a stack-merge action for PR#3 will validate PR#1, PR#2 and PR#3 leaving PR#4 untouched. After merging, the stack would look like:

master <- PR#4

There are a few ways to request queueing a stack of PRs.

  • Chrome Extension (recommended): This is the simplest way to request way since the user experience for this is very similar to merging a regular PR. Go to PR#3 from above example in GitHub and click "Queue pull request" button:

  • GitHub Label: You can also queue the stack the same way using GitHub label like you would a single PR. To do so, just apply the label at the top PR that would want to merge with the stack. In the example above, apply the label on PR#3 .

  • CLI: Another way to queue the PR is via the av command line. Simply checkout the branch associated with PR#3 and run the command:

av pr queue
/aviator merge

Merge behavior

Depending on the queue mode being used, the merge behavior for stacked PRs can vary.

Sequential mode (default mode)

Taking the example above, in sequential mode:

  • Aviator will consider PR#1, PR#2 and PR#3 as a single PR in the queue.

  • When this PR reaches the top of the queue, Aviator only updates PR#3 with the target branch (mainline), and run the CI.

  • Once the CI passes, Aviator will change the base branch of PR#3 and merge it

  • Since PR#3 is stacked on top of PR#1 and PR#2, merging PR#3 also merges all the changes associated with PR#1 and PR#2.

  • Since GitHub does not recognize that PR#1 and PR#2 are already merged, Aviator automatically closes them and applies the GitHub label merged-by-mq to represent that the PRs are indeed merged.

Parallel mode

Similar to Sequential mode, parallel mode also considers the stack as a single PR in the queue. In parallel mode:

  • Aviator creates a batch using the head branch of PR#3 including all the changes of PR#1 and PR#2 as well.

  • After the batch passes CI, Aviator changes the base branch of PR#3 and merges it.

  • Since PR#3 is stacked on top of PR#1 and PR#2, merging PR#3 also merges all the changes associated with PR#1 and PR#2.

  • As in Sequential mode, Aviator closes PR#1 and PR#2, while applying the GitHub label merged-by-mq to represent that the PRs are indeed merged.

Fast forwarding

In fast-forwarding mode:

  • When the stack with PR#3 is requested merging, Aviator creates one squash commit for each PR in the stack.

  • After CI passes, the mainline is fast-forwarded to the latest commit in the batch associated with PR#3, this includes separate commits associated with PR#2 and PR#1 in the linear history.

Separating the merge commits

By default the Sequential and Parallel modes create a single commit in the mainline for all of the stacked PRs that are queued together. This is because GitHub does not let an app account bypass the branch protection rules. Even when allowed to bypass the rules, GitHub will let the Aviator app only bypass the approval requirement and PR creation requirement, not the CI validation requirement.

Rulesets

Once migrated to Ruleset, you can add Aviator app in the bypass list.

Configuring separate commits

Once Rulesets are configured and other GitHub branch protection rules are disabled, you can configure Aviator to start creating separate commits for stacked PRs. To do so, set the following in the merge_strategy section of the configuration YAML.

merge_strategy:
  use_separate_commits_for_stack: true

Detecting stacked PRs without av CLI

If you are creating stacks manually or using a thirdparty tool, you can enable auto-detection of stacked PRs using the config:

merge_rules:
  auto_detect_stacks: true

Note that, auto-detection can have some side effects where Aviator might detect PRs in a stack even when they were not intentionally created as stacked. For instance, if you have a PR from a releasebranch to main to backport some changes, meanwhile have a PR from a featureAbranch to releasebranch, the auto-detect will detect this as a stack. To avoid this, you can add releasebranch as one of the base branches in the config.

Note that, using this command requires .

Slash command: A stack or sub-stack can also be merged by commenting a from the GitHub interface:

See also .

See also .

provides a simpler experience for merging stacked PRs. Since in case of fast-forwarding, we fast-forward the mainline to commits in draft PRs, the CI is already passing. This allows Aviator to merge the PRs individually without GitHub blocking the commits.

This capability of bypassing the CI requirement is now available using GitHub’s . Rulesets offer feature parity with the configurations you use in classic branch protection rules and you should be able to migrate all your existing configurations to using Rulesets.

For details, refer to the .

If you need assistance in setting up the Rulesets, please contact .

authenticating the CLI with your Aviator account
slash command
Fast forwarding mode
Rulesets
configuration reference
howto@aviator.co
Separating the merge commits
Separating the merge commits
open-source CLI
queue mode
Queue pull request action for stacked PRs
Add Aviator GitHub app to Bypass list