Search code examples
gitopenstackgerritgit-review

How to split a huge code to submit several patchsets in gerrit


I already ask a question but I have not found the suitable answer yet.

How to a huge code to small patches in Gerrit

For example, my code has several python file: p1.py, p2.py,..., p5.py.

Now I want to group (p1.py and p2.py) in one patchset and group (p3.py. p4.py and p5.py) in another patchset. But the condition is that 2 groups should be the same branch name. Here is an example:

An example shows different patchsets with the same branch name

Please let me know how I can do like this.


Solution

  • First you have to make git add p1.py and git add p2.py then git commit -m "<message>" and push it to your branch and you will have Change-Id. After push add the other files (p3.py, p4.py, p5.py), edit commit message with git commit --amend command. Now you can make git push and you will have new patch set. Change Id will remain in the commit message. But in case you want to be sure, use amend with --no-edit to disable modifying the commit message.