git 格里特:![远程拒绝] HEAD -> refs/publish/master(无新变化)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23808032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:06:40  来源:igfitidea点击:

Gerrit: ! [remote rejected] HEAD -> refs/publish/master (no new changes)

gitgerrit

提问by stackular

I made some changes, committed them and pushed the branch to Gerrit (git push gerrit). Now my changes don't appear in Gerrit and I assume this is because I pushed the changes manually instead of using git review. When I run git reviewnow, Im getting this error:

我做了一些更改,提交它们并将分支推送到 Gerrit ( git push gerrit)。现在我的更改没有出现在 Gerrit 中,我认为这是因为我手动推送了更改而不是使用git review。当我git review现在运行时,我收到此错误:

remote: Processing changes: refs: 1, done    
To ssh://user@gerrit-host:29418/Project
! [remote rejected] HEAD -> refs/publish/master (no new changes)
error: failed to push some refs to 'ssh://user@gerrit-host:29418/Project'

How can I tell Gerrit that my changeset needs to be reviewed?

我如何告诉 Gerrit 我的变更集需要?

采纳答案by HiB

I think the problem is that the commit already in remote branch. That is why no new changes on push. First try to removethe commit from remote branch, and then push the commit to review branch.

我认为问题在于提交已经在远程分支中。这就是为什么推送没有新的变化。首先尝试从远程分支删除提交,然后将提交推送到分支。

回答by aibotnet

you can remove that commit from remote branch or you can do this

您可以从远程分支中删除该提交,或者您可以执行此操作

git commit --amend

this will create a new patch

这将创建一个新补丁

git push gerrit HEAD:refs/for/your_branch

回答by JESii

I've found that git reviewwill not submit a branch with no changes. It's basically saying: "since there are no changes in your commit there's no reason to submit... so I won't". Unlike your situation, this has happened to me when there was an error in the previous push.

我发现git review不会提交没有更改的分支。它基本上是在说:“因为你的提交没有变化,所以没有理由提交......所以我不会”。与你的情况不同,这发生在我上次推送出现错误时。

What I've done in these cases is simply add a minor change (such as adding a blank line) so that gerrit see things as different and then it works.

在这些情况下,我所做的只是添加一个小的更改(例如添加一个空行),以便 gerrit 看到不同的东西,然后它就可以工作了。

Another thing you could do (depending on the process your organization uses) is to remove the Change-Id from your change log (using git commit --amend) and then run git review, thus creating a new review set, essentially staring over as far as Gerrit is concerned.

您可以做的另一件事(取决于您的组织使用的流程)是从您的更改日志中删除 Change-Id(使用git commit --amend)然后运行git review,从而创建一个新的集,基本上就 Gerrit 而言是盯着看。

回答by TTKatrina

git commit --amendcan't resolve several commits, only can push last one to gerrit.

git commit --amend无法解决多个提交,只能将最后一个提交给 gerrit。

Another resolution is to checkout and use cherry-pick commitid1 commitid2 commitid3, then push.

另一个解决方案是结帐并使用cherry-pick commitid1 commitid2 commitid3,然后推送。

回答by NRN

To avoid this error

为了避免这个错误

! [remote rejected] HEAD -> refs/for/develop (no new changes)

Just follow these steps

只需按照这些步骤

git commit --amend # this will create a new patch
git push gerrit HEAD:refs/for/your_branch