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?
Just follow the below steps:
git add <modified file>
.git commit --amend
that pops up a COMMIT-EDITMGS window. Save it accordingly.Push your change to gerrit using git push origin HEAD:refs/for/branch_name
It will create a new patch set.
Consult Trying out a Change in the official documentation.
Here is what you do:
git --amend
and remove the Change-Id
in the commit messageChange-Id
will automatically be added and this will result in a new Change SetAs pointed out by @magnus-bäck, I was describing how to create a new Change-Set. If you want to add a new Patch Set to the current review you should NOT remove the Change-Id
.
@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
On Gerrit, go to the review, select "checkout", on the Download field as opposed to "pull", "cherry-pick", or "patch", then copy the command.
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.)
Name that horse! git checkout -b new_branch_name
Change what you want and do a git add
on the files you want.
Do git commit --amend
and keep the same Change-Id
.
Push your changes:
git push origin <new_branch_name>:refs/for/<thatgerritbranchyouwanttochange>