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
  • Before you begin
  • Initialize your repository with Aviator CLI
  • Create a topic branch
  • Create a pull-request
  • Stack a new topic branch
  • Create a second pull-request
  • Merge and sync the pull-requests
  • What's next

Was this helpful?

  1. Stacked PRs CLI

Quickstart for Stacked PRs CLI

Quickstart guide for Stacked PRs CLI. Learn how to use Aviator CLI to drive day-to-day development. Initialization guidelines, topic branch creation, and more.

PreviousStacked PRs CLINextCLI Installation

Last updated 5 months ago

Was this helpful?

This page explains how to use Aviator CLI to drive day-to-day development.

Before you begin

  1. Clone your repository locally

Initialize your repository with Aviator CLI

Run av init inside your repository. You need to do this only once per your local clone.

$ av init
Successfully initialized repository for use with av!

Create a topic branch

You can create a branch with av branch BRANCH_NAME from main, or you can also use av commit --branch-name BRANCH_NAME to both create a branch and commit your changes to the new branch.

$ git switch main
Already on 'main'
Your branch is up to date with 'origin/main'.
$ echo "Some changes" > testfile
$ av commit -A -m "Add a new file" --branch-name mytopic
[mytopic b420345] Add a new file
 1 file changed, 1 insertion(+)
 create mode 100644 testfile

The topic branch mytopic is intended to be merged to main later. If you want to use other branch as the merge destination, checkout that branch first.

Create a pull-request

Create a pull-request with av pr. It shows an editor for the pull-request description. Every time you update your local branch, you can run this to update the pull-request.

$ av pr
Creating pull request for branch mytopic:
  - pushing to origin/mytopic
  - created pull request https://github.com/yourname/yourrepo/pull/16

Stack a new topic branch

Create a new topic branch on top of the current topic branch with av branch.

$ av branch another_topic

You can see the stack with av tree.

$ av tree
  * another_topic (HEAD)
  │ No pull request
  │
  * mytopic
  │ https://github.com/yourname/yourrepo/pull/16
  │
  * main

Add more changes to the branch.

$ echo "More changes" > newfile
$ av commit -A -m "Add another file"
[another_topic f60c4da] Add another file
 1 file changed, 1 insertion(+)
 create mode 100644 newfile
nothing to restack

Create a second pull-request

The second pull-request can be created with av pr now.

$ av pr
Creating pull request for branch another_topic:
  - pushing to origin/another_topic
  - created pull request https://github.com/yourname/yourrepo/pull/17

You can see the pull-request URLs with av tree.

$ av tree
  * another_topic (HEAD)
  │ https://github.com/yourname/yourrepo/pull/17
  │
  * mytopic
  │ https://github.com/yourname/yourrepo/pull/16
  │
  * main

The first pull-request is targeting the main branch. And the second pull-request is targeting the first pull-request branch.

This will be updated once you merge the first pull-request.

Merge and sync the pull-requests

Let's merge the first pull-request now. We merge the first pull-request and keep the second pull-request open.

After this, we want to make the second one to be rebased on top of the newly updated main branch. To do this, we run av sync.

$ av sync

  ✓ GitHub fetch is done
  ✓ Restack is done

    * ✓ another_topic e808923
    │
    * main ba8eefe

  Confirming the push to GitHub

    Following branches do not need a push.

      mytopic: PR is already merged.

    Following branches need to be pushed.

      another_topic
        Remote: cb51296 Add another file 2024-06-25 13:01:45 -0700 -0700 (1 minute ago)
        Local:  e808923 Add another file 2024-06-25 13:03:07 -0700 -0700 (10 seconds ago)
        PR:     https://github.com/yourname/yourrepo/pull/17

  Are you OK with pushing these branches to remote?
    ▸ Yes. Push the branches to GitHub.
      No. Do not push the branches to GitHub.
  ↑/k move up • ↓/j move down • space/enter select • ctrl+c cancel

It fetches the latest main from the remote, rebase the second branch on top of it. Choose to push to the remote.

$ av sync

  ✓ GitHub fetch is done
  ✓ Restack is done

    * ✓ another_topic e808923
    │
    * main ba8eefe

  ✓ Pushed to GitHub

    Following branches do not need a push.

      mytopic: PR is already merged.

    Following branches are pushed.

      another_topic
        Remote: cb51296 Add another file 2024-06-25 13:01:45 -0700 -0700 (2 minutes ago)
        Local:  e808923 Add another file 2024-06-25 13:03:07 -0700 -0700 (1 minute ago)
        PR:     https://github.com/yourname/yourrepo/pull/17

  Confirming the deletion of merged branches

    Following merged branches can be deleted.

      mytopic: 6d19ed1f0019d0f59b65177ef7a4f358c278baec

  Are you OK with deleting these merged branches?
    ▸ Yes. Delete these merged branches.
      No. Do not delete the merged branches.
  ↑/k move up • ↓/j move down • space/enter select • ctrl+c cancel

Since the first branch is already merged, it asks you if you want to delete the local branch. Choose yes to delete the merged branch.

If you run av tree, you can see that the second branch now has main as the parent.

$ av tree
  * another_topic
  │ https://github.com/yourname/yourrepo/pull/17
  │
  * main (HEAD)

What's next

.

Review the How-to guides for common CLI commands
Learn how to add Aviator CLI commands as a Git subcommand
Learn how to adopt a branch created from Git command
Install Aviator CLI
Set up GitHub Personal Access Token