Company
Word count
372
Language
English
Contains code?

Text

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. 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

$ av branch stack-1
$ echo 1a >> myfile
$ git commit -m 1a myfile
$ echo 1b >> myfile
$ git commit -m 1b myfile
$ echo 2a >> myfile
$ git commit -m 2a myfile
$ echo 2b >> myfile
$ git commit -m 2b myfile

This creates 4 commits. Split the branch 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. Fold the branches 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. Previous How Split a Commit in CLI Next How to Rename a Branch in CLI Last updated 1 year ago Was this helpful?

Analysis

No analysis created yet for this page.