You can create stacked PRs with Aviator CLI and send them for review. Your reviewer might request some code changes in one of the PRs in the middle of the stack. This how-to guide explains how to add a change in such cases. Setup Let's use Hello-World repository as an example. Copy
$ git clone https://github.com/octocat/hello-world hello-world
$ cd hello-world
$ av init
$ touch myfile
$ git add myfile
Then, create one branch. Copy
# Using just 'av'
$ echo 1a >> myfile
$ av commit -A -m 1a --branch-name stack-1
$ echo 1b >> myfile
$ av commit -A -m 1b
# Or with a mix of 'av' and 'git'
$ av branch stack-2
$ echo 2a >> myfile
$ git commit -m 2a myfile
$ echo 2b >> myfile
$ git commit -m 2b myfile
This creates 2 branches. Changing the stack-1 We have two branches that correspond to two PRs;
stack-1
and
stack-2
. Let's assume that we need to change the
stack-1
. By running
av prev
, you can move back to the previous branch. You can switch the branch with
av switch
,
git switch
, or
git checkout
as well. Now make a necessary change. Currently the commit graph is like this: We want to make
stack-2
to be on top of the new commit 1c. To do this, run
av sync
. The file has a rebase conflict. Open
myfile
and resolve the conflict, and continue. Now the
stack-2
is rebased on top of the new commit 1c. Convenient CLI commands When you need to change the commit in the middle of the stack, you almost always need to rebase to align the child branches. Aviator CLI has convenient commands,
av commit
and
av commit --amend
that runs
git commit
along with
av restack
afterwards. Previous How to Navigate & Modify Stacked PRs Next How Split a Commit in CLI Last updated 1 year ago Was this helpful?