Occasionally you might accidentally create a large pull request. In order to do an effective code review, you want to split such large PRs. Aviator CLI allows you to split them.
Overall Workflow
In Aviator CLI, one branch corresponds to one PR. To split a large pull request, we take two steps:
Split a large commit into multiple commits.
Reorder and split commits into stacked branches.
By using Split a Commit feature, you can split a large commit into pieces. The guide below walks you through how to reorder and split those commits.
Currently, we have a branch stack-1, branched off from master. We will move the commit 2a and 2b into stack-2. To do this, change the plan into following:
Save and close the editor. Aviator CLI picks up the commit 1a and 1b on stack-1 and picks up the commit 2a and 2b on stack-2.
Starting branch stack-1 at 7fd1a60
- applied commit 7329d18 without conflict (HEAD is now at 7329d18)
- applied commit a89140c without conflict (HEAD is now at a89140c)
Starting branch stack-2 at a89140c
- applied commit 4702825 without conflict (HEAD is now at 4702825)
- applied commit e875223 without conflict (HEAD is now at e875223)
Reorder complete!
The stack was reordered successfully.
This creates a commit graph like this.
Fold the branches
The opposite operation is possible as well. Run av stack reorder again.
Remove stack-branch stack-2 --parent stack-1, save, and exit.
WARNING: the following branches were removed from the reorder:
- stack-2
What would you like to do?
[a] Abort the reorder
[d] Delete the branches
[e] Edit the reorder plan
[o] Orphan the branches (the Git branch will continue to exist but will not
be tracked by av).
[a/d/e/o]: d
Starting branch stack-1 at 7fd1a60
- applied commit 7329d18 without conflict (HEAD is now at 7329d18)
- applied commit a89140c without conflict (HEAD is now at a89140c)
- applied commit 4702825 without conflict (HEAD is now at 4702825)
- applied commit e875223 without conflict (HEAD is now at e875223)
Deleted branch stack-2.
Reorder complete!
The stack was reordered successfully.
This time, since we removed the branch stack-2 from the plan, it prompts you what to do with that branch. Since we do not need it anymore, we choose "Delete the branches".
The branch stack-1 now has the commit 1a through 2b.