分支/更改未合并,尽管Gerrit声称是 [英] Branch/change not merged, though Gerrit claims, it is

查看:109
本文介绍了分支/更改未合并,尽管Gerrit声称是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我在Gerrit中进行更改时都会看到merged状态,并且可以清楚地看到git pull origin我的更改/分支实际上并未合并到主版本中.

Each time, I see merged status on my change in Gerrit and I do git pull origin, I can clearly see, that my change/branch hasn't actually been merged into master.

请检查我的Gerrit的工作流程,并告诉我我做错了什么或我错过了什么:

Please, review my Gerrit's workflow and tell me, what I'm doing wrong or what am I missing:

  1. 创建&本地结帐分支.

  1. Create & checkout branch locally.

git checkout -b 77-blah

做魔术,并注释所有更改.

Do the magic and comment all changes.

git commit -am "changes to 77-blah"

使用UI创建相同的分支并将其修订版本设置为HEAD(此应尽快实现自动化 ).

Create the same branch using UI and setting its revision to HEAD (this should be automated soon).

将更改(该特定分支)更改为Gerrit,并带有适当的引用refs:

Push changes (that particular branch) to Gerrit, with proper refs refs:

git checkout 77-blah

git push origin HEAD:refs/for/77-blah

Gerrit给我访问URL,查看我的更改或等待其他人查看它.

Visit URL, Gerrit gave me, review my change or wait for someone else to review it.

再次访问更改的URL,请确保输入Status = Merged.

Visit change's URL again, make sure that Status = Merged.

从Gerrit获取最新更改:

Pull latest changes from Gerrit:

git checkout master

git pull origin

最后一个命令的结果以Already up-to-date结尾,(如果我不傻的话)表示我的母版是最新的.在正常的Git回购中,这是正确的.我的master分支将变为最新的,而我的最新(77-blah)分支已经合并到该分支.

Last command's result ends with Already up-to-date, which (if I'm not stupid) means, that my master is up-to-date. In normal Git's repo, at this point, this would be true. My master branch would become up-to-date, with my latest (77-blah) branch already merged to it.

在Gerrit上,我正在刷新自己的网页,而我目前正在工作(当我在master时),只是发现,该特定分支中引入的所有更改都已消失,整个网站都在创建最新分支之前先声明. Gerrit 只声称,说我的master是最新的.

On Gerrit I'm refreshing my webpage, that I'm currently working in (while I'm on master) only to find out, that all changes introduced in that particular branch are gone and the entire website is in state before creating latest branch. Gerrit only claims, that my master is up to date.

我可以通过执行git branch -d 77-blah并得到结果来确认这一点:

And I can confirm that, by executing git branch -d 77-blah and getting as the result:

error: The branch '77-blah' is not fully merged.
If you are sure you want to delete it, run 'git branch -D 77-blah'.

实际上,我必须在本地手动合并最新的分支机构.我想念什么?

Actually, I have to merge my latest branch manually locally. What am I missing?

(按Gerrit的说法)更改是合并,而实际上根本没有合并是什么意思?

What does it mean (in Gerrit terms) that change is merged, while it actually isn't merged at all?

推荐答案

在几个类似的问题中,一个共同的主题似乎是您认为应该将本地主题分支推送到Gerrit中具有相同名称的分支,并且提交更改(即使更改显示为 Merged )意味着Gerrit应该将更改合并到master.这是不正确的.

A common theme in your couple of similar questions seems to be that you think you should push your local topic branch to a branch with the same name in Gerrit, and that submitting the change (i.e. making the change show up as Merged) means that Gerrit should merge the change to master. This is incorrect.

当您推送到refs/for/whatever并随后提交该更改时,提交最终将在分支whatever上结束.不是master.如果您希望更改在master中结束,则应推送到refs/for/master.因此,Git声称master是最新的是正确的(该分支不受您提交对77-blah的更改的影响),而Gerrit声称您的更改已被合并也是正确的(更改已合并到).

When you push to refs/for/whatever and later submit that change, the commit ends up on the branch whatever. Not master. If you want the change to end up in master you should push to refs/for/master. So, Git's claim that master is up to date is correct (that branch is unaffected by your submission of a change to 77-blah) and Gerrit's claim that your change has been merged is also correct (the change was merged to 77-blah).

本地主题分支与服务器上维护的分支无关.它们之间通常是1:1的关系,这是不寻常且很少需要的.实际上,在Gerrit服务器上创建分支(即具有refs/heads/*的Push权限)通常是大多数用户无法执行的特权操作.他们可以做的就是按refs/for/*上载其更改以供审核.他们可以在本地创建所需的任何分支.

Local topic branches are unrelated to the branches maintained on the server. It's unusual and rarely desirable to have a 1:1 relationship between them. In fact, creating branches on the Gerrit server (i.e. having the Push permission for refs/heads/*) is usually a privileged action that most users can't perform. What they can do is push to refs/for/* to upload their changes for review. Locally they can course create any branches they want.

这篇关于分支/更改未合并,尽管Gerrit声称是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆