Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change a patchset and push it as a new one?

Tags:

gerrit

Is it possible to fetch an existing patchset (that has not been merged into my local machine), change and push it as a new Patch Set?

like image 839
Alexandre Santos Avatar asked Jun 27 '14 17:06

Alexandre Santos


People also ask

How do I revert a Patchset in Gerrit?

Cherry-pick the specific "patch set" of the "change list" (e.g. if there are 15 patch sets in a Change List and want to revert back to patch set #8). Get the cherry-pick command from Gerrit UI for the required patch set. Run that cherry-pick command, and use git commit --amend , then push your change.

How do I amend a commit in Gerrit?

The process of modify same commit and commit message on gerrit after patchset creation is pretty straight forward. Step 1 – Do the required modification in the code based on the review. Step 2 – Add files using git add commands. Step 3 – Command to update/amend the most recent commit.


1 Answers

@Uncletall put all the steps there and the link, the only thing is that you should not delete the changeId and you should do a git commit --amend. I am giving him a +1.

It should be like this

  1. On Gerrit, go to the review, select "checkout", on the Download field as opposed to "pull", "cherry-pick", or "patch", then copy the command.

  2. On the git project paste the copied link from above

    This will create a detached head, which is a branch with no name (I've been through the desert on a horse with no name, It felt good to be out of the rain.)

  3. Name that horse! git checkout -b new_branch_name

  4. Change what you want and do a git add on the files you want.

  5. Do git commit --amend and keep the same Change-Id.

  6. Push your changes:

    git push origin <new_branch_name>:refs/for/<thatgerritbranchyouwanttochange>

like image 114
Cindy Langdon Avatar answered Oct 29 '22 08:10

Cindy Langdon