'How to remove WIP flag from Gerrit changeset with Git

I've pushed a work-in-progress (WIP) changeset to Gerrit by pushing to refs/for/master%wip, as per the documentation.

The documentation also states that one can remove the WIP flag from a changeset by pushing it to refs/for/master%ready, but Gerrit consistently rejects the push with the error

! [remote rejected] mybranch -> refs/for/master%ready (no new changes)

Force-pushing doesn't help either.

Is there a way to remove the WIP flag via Git without introducing artificial changes?



Solution 1:[1]

Unfortunately you can't set the WIP flag using the "git push" command without pushing a new patchset.

You can, of course, use the graphical interface or you can post to /changes/CHANGE-ID/ready to set the WIP flag using REST. See more info here.

Solution 2:[2]

In case you don't have anything to push, but you want to mark your commit as ready, you can execute the following commands:

git commit --amend --no-edit
git push origin HEAD:refs/for/master%ready ==> replace "master" with your branch name.

Solution 3:[3]

You can always remove flag using GUI by pressing start review button.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcelo Ávila de Oliveira
Solution 2 MA1
Solution 3 Matus Babinsky