如果在推向Gerrit时错过了一些关键参考,该怎么办 [英] What to do, when missed some key refs during push to Gerrit
问题描述
我是Git的新手,甚至更加喜欢Gerrit,并且有点失落。我的工作流可能是标准的:创建一个新分支,执行 magic ,提交更改,将它们推送到Gerrit的repo。
在Gerrit的Web UI中是可见的,但是更改根本不可见。
阅读完这个答案, Gerrit's docs 等等,我很容易和快速地发现,我错过了神奇的 refs。而不是 git push origin HEAD:refs / for / {branch name}
我只是做了 git push origin
p>
太好了!但是,如何从这种情况中恢复?每当我尝试再推一次,这次用适当的参考,我得到! [远程拒绝](无新变化)
。
这是什么意思,我该怎么办? 这是否意味着我无法以任何其他方式解决此问题,而不是添加新的更改,提交并再次推送?(否,即使推送另一个提交也没有解决问题,Gerrit合并新的推进到主,但完全放弃了以前的一个;不幸的是,这超出了我的想象!)
- 通过
git push origin:< branch>
, 删除远程分支> - 删除本地分支的提交
git reset --soft HEAD ^
, -
git stash
, - 使用本地分支通过
git push origin< branch>创建远程分支
, - 通过
git stash pop
, - 将其提交到
refs / for /< branch>
。
I'm new to Git and even newer to Gerrit and got a little bit lost. My workflow was probably standard: create a new branch, do the magic, commit changes, push them to Gerrit's repo.
My newly pushed branch is visible in Gerrit's web UI, but change is not visible at all.
After reading this answer, Gerrit's docs and many more, I easily and quickly found, that I missed magical refs. Instead of git push origin HEAD:refs/for/{branch name}
I did just git push origin
.
Great! But, how to recover from this situation? Whenever I try to push again, this time with proper refs, I'm getting ! [remote rejected] (no new changes)
.
What does this mean and what can I do? Does it mean, that I can't fix this in any other way, than adding new changes, committing them and pushing again? (no, even pushing another commit didn't solve the problem, Gerrit merged new push into master, but completely dropped previous one; this is beyond my imagination, unfortunately!)
You can:
- delete the remote branch by
git push origin :<branch>
, - remove the commit from local branch
git reset --soft HEAD^
, - stash the modifications by
git stash
, - create the remote branch with you local branch by
git push origin <branch>
, - get back the uncommitted changes by
git stash pop
, - commit it, and push it to
refs/for/<branch>
.
这篇关于如果在推向Gerrit时错过了一些关键参考,该怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!