Git / gerrit,推送远程拒绝不做任何更改 [英] Git / gerrit, push remote rejected no changes made

查看:2282
本文介绍了Git / gerrit,推送远程拒绝不做任何更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对提交进行了更改,执行了commit commit。做一个推动,我得到的错误:

 ! [remote rejected] master  - > refs / for / master(不作更改)

检查提交消息中的更改ID,一个有效的提交。



我试过更改一个文件,检查它显示为一个变更,然后添加到暂存区域并完成另一个提交修改。再次尝试推送并获得相同的问题。没有想法在这一个。



编辑:这是推动gerrit,而不是直接。



m运行:

  git push origin master:refs / for / master 

获得原产地细节的结果是(附有公司的详细信息):

  $ git remote show origin 
* remote origin
抓取网址:ssh://lytee@gerrit.mycompany.net:29418 / myrepo
推送网址:ssh ://lytee@gerrit.mycompany.net:29418 / myrepo
HEAD分支:master
远程分支:
跟踪的主数
为'git pull'配置的本地分支:
master rebase添加到远程主
配置为'git push'的本地ref:
master推送给master(最新)


解决方案

这个问题是由于我之前执行的操作。我正在尝试推送一项新的更改,除了需要审核的更改外,还有一位家长也在等待审核。

  Trunk ------ Parent A ----- Parent B -----新变化
(合并)(未合并)(未合并)

我曾使用 cherry-pick 在本地获得这两个更改(Parent A和Parent B),然后在尝试 cherry-pick 从本地分支获取我的更改>推。这就是造成这个问题的原因,因为我个人的变化本质上是试图重写历史。



正确的过程只会是 pull 父母B在中继线。这会自动提取中继和它之间的任何提交(在这种情况下,只是父A)。然后 cherry-pick 我最新的变化和 push 都可以正常工作。


Made changes to a commit, performed commit amend. Do a push and I get the error:

! [remote rejected] master -> refs/for/master (no changes made)

Checked the change ID in the commit message and its still a valid commit.

I've tried changing a file, checking it shows up as an alteration and then added to staging area and done another commit amend. Try the push again and getting the same issue. No idea on this one.

Edit: This is pushing to gerrit, not git directly.

I'm running:

git push origin master:refs/for/master

And the result of getting the details of origin are (with company details edited out):

$ git remote show origin
* remote origin
  Fetch URL: ssh://lytee@gerrit.mycompany.net:29418/myrepo
  Push  URL: ssh://lytee@gerrit.mycompany.net:29418/myrepo
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master rebases onto remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

解决方案

This issue is due to the actions I'd performed previously. I was trying to push a new change, on top of a change which was still up for review, who's parent also was up for review.

 Trunk ------ Parent A ----- Parent B ----- New change
(merged)     (unmerged)     (unmerged)

I had used cherry-pick to obtain these two changes locally (Parent A and Parent B), and then a third cherry-pick to get my change from a local branch before attempting to push. That is what caused the issue, because my personal change was essentially trying to re-write history.

The correct process would be to only pull Parent B when at trunk. This automatically pulls up any commits between trunk and it (in this case just Parent A). Then cherry-pick my new change on top of that and push will work fine.

这篇关于Git / gerrit,推送远程拒绝不做任何更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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