首页 > 解决方案 > 如何使用 Git 从 Gerrit 变更集中删除 WIP 标志

问题描述

根据文档refs/for/master%wip,我已通过推送到 将正在进行的工作 (WIP) 变更集推送到 Gerrit 。

该文档还指出,可以通过将 WIP 标志从变更集中推送到refs/for/master%ready,但 Gerrit 始终拒绝推送并出现错误

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

强制推也无济于事。

有没有办法在不引入人为更改的情况下通过 Git 删除 WIP 标志?

标签: gitgerrit

解决方案


如果您没有要推送的内容,但您想将提交标记为就绪,您可以执行以下命令:

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

推荐阅读