Giter Site home page Giter Site logo

av's Introduction

av: CLI to manage Stacked PRs


av is a command-line tool that helps you manage your stacked PRs on GitHub. It allows you to create a PR stacked on top of another PR, and it will automatically update the dependent PR when the base PR is updated. Read more at Rethinking code reviews with stacked PRs.

Community

Join our discord community: https://discord.gg/TFgtZtN8

Features

  • Create a PR that is stacked on another PR.
  • Visualize the entire stack of PRs.
  • Interactively navigate through the PR stack.
  • Rebase the dependent PR when the base PR is updated.
  • Remove the merged PRs from the stack.
  • Split a PR into multiple PRs.
  • Split a commit into multiple commits.
  • Reorder the PRs and commits in the stack.

Demo

Demo

Usage

Tip

Complete documentation is available at docs.aviator.co.

Create a new branch and make some changes:

$ av stack branch feature-1
$ echo "Hello, world!" > hello.txt
$ git add hello.txt
$ git commit -m "Add hello.txt"

Create a PR:

$ av pr create

Create a new branch and make some changes. Create another PR that depends on the previous PR:

$ av stack branch feature-2
$ echo "Another feature" >> hello.txt
$ git add hello.txt
$ git commit -m "Update hello.txt"
$ av pr create

Visualize the PR stack:

$ av stack tree
  * feature-2 (HEAD)
  │ https://github.com/octocat/Hello-World/pull/2
  │
  * feature-1
  │ https://github.com/octocat/Hello-World/pull/1
  │
  * master

Merge the first PR:

$ gh pr merge feature-1

Sync the stack:

$ av stack sync

  ✓ GitHub fetch is done
  ✓ Restack is done

    * ✓ feature-2 f9d85fe
    │
    * master 7fd1a60

  ✓ Pushed to GitHub

    Following branches do not need a push.

      feature-1: PR is already merged.

    Following branches are pushed.

      feature-2
        Remote: dbae4bd Update hello.txt 2024-06-11 16:41:18 -0700 -0700 (2 minutes ago)
        Local:  f9d85fe Update hello.txt 2024-06-11 16:43:41 -0700 -0700 (7 seconds ago)
        PR:     https://github.com/octocat/Hello-World/pull/2

  ✓ Deleted the merged branches

    Following merged branches are deleted.

      feature-1: f2335eec783b54226a7ab90f4af1c9b8309f8b61

Installation

av is available for macOS and Linux. In order to interact with GitHub, av uses the GitHub API token. If you have GitHub CLI installed, av will use the token automatically from the GitHub CLI. It is recommended to install both.

macOS

brew install gh aviator-co/tap/av

Binary download

Download the binary from the releases page.

Setup

  1. Set up the GitHub CLI for GitHub authentication:

    gh auth login

    Or you can create a Personal Access Token as described in the Configuration section.

  2. Set up the av CLI autocompletion:

    # Bash
    source <(av completion bash)
    # Zsh
    source <(av completion zsh)
  3. Initialize the repository:

    av init

Example commands

Command Description
av stack branch Create a new child branch from the current branch.
av stack restack Rebase the branches to their parents.
av pr create Create or update a PR.
av stack tree Visualize the PRs.
av stack sync --all Fetch and rebase all branches.
av stack adopt Adopt a branch that is not created from av stack branch.
av stack reparent Change the parent of the current branch.
av stack switch Check out branches interactively.
av stack reorder Reorder the branches.
av commit amend Amend the last commit and rebase the children.
av commit split Split the last commit.

How it works

av internally keeps tracks of the PRs, their associated branches and their dependent branches. For each branch, it remembers where the branch started (the base commit of the branch). When the base branch is updated, av rebases the dependent branches on top of the new base branch using the remembered starting point as the merge base.

Learn more

av's People

Contributors

twavv avatar draftcode avatar dependabot[bot] avatar erichkramer avatar konboi avatar doratzeng avatar oleg-codaio avatar jainankit avatar ohcnivek avatar brookke avatar andrewwdye avatar jsoref avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.