Development/gerrit/SplitPatch

Split a patch after it was uploaded to gerrit
You have uploaded a patch to gerrit and your reviewer said: "Please split it into two patches". It is clear what the reviewer wants, but how to do this? This is only a matter of a couple of git commands.

Get a change
Start by downloading the gerrit patch and create a branch from there:

Start a rebase process
Start rebase, save and exit:

Unstage your changes
Unstage the file in your commit:

Pick up files you want to preserve in your first change
Pick up files that should stay in your first change:

Note: if you do commit this way:

you are going to lose your ChangeId. To preserve it, copy it from your last commit and paste it into the editor where you are writing the commit message. In this way it wouldn't be overridden by commit-hook.

Swap the order of commits (optionally)
Depending on your concrete change and the relation of your changes to each other, you should take care about the order of your changes. If you need to swap the order of changes, you have to rebase again:

Now push
See: How to submit patches

Note: if you are going to do it with  you would get a warning, that you are going to upload more than one change. In this case it is okay, just say yes, in the end you do know what you are doing.