How to Split and Fold Pull Requests
Learn how to split and fold pull requests in our how-to guide. It's helpful when you accidentally create a large pull request and must split it for code review.
Last updated
Was this helpful?
Learn how to split and fold pull requests in our how-to guide. It's helpful when you accidentally create a large pull request and must split it for code review.
Last updated
Was this helpful?
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.
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 , you can split a large commit into pieces. The guide below walks you through how to reorder and split those commits.
Let's use repository as an example.
Then, create one branch.
This creates 4 commits.
Run av reorder
. It opens an editor and shows the initial reordering plan.
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
.
This creates a commit graph like this.
The opposite operation is possible as well. Run av reorder
again.
Remove stack-branch stack-2 --parent stack-1
, save, and exit.
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.