Git merge pending due to an abandoned commit

倾然丶 夕夏残阳落幕 提交于 2019-11-30 15:40:03

There are several ways to fix your problem. Pick whichever you feel most comfortable with.

Here is one:

  1. git checkout yourbranch (make sure you are on the right branch)
  2. git reset --hard A^ (reset everything to the commit before A)
  3. git cherry-pick B (where B is the hash of the commit you want to keep)
  4. git log (confirm that it is what you wanted)
  5. git push --force (may need to specify other options depending on how you usually push)

Here is another, result is equivalent:

  1. git checkout yourbranch (make sure you are on the right branch)
  2. git rebase --onto A^ A (rebase everything after A on top of the commit before A, effectively removing A)
  3. git log (confirm that it is what you wanted)
  4. git push --force (may need to specify other options depending on how you usually push)

Here is a third, result still equivalent:

  1. git checkout yourbranch (make sure you are on the right branch)
  2. git rebase --interactive A^ (will open up your editor)
  3. Delete the line showing commit A, save and close
  4. git log (confirm that it is what you wanted)
  5. git push --force (may need to specify other options depending on how you usually push)
Moises Gonzaga

Here is an issue like yours.

If committ B has a dependency on A, then B cannot be merged until A is merged. Since you have abandoned A, Gerrit will not automatically merge B.

What you will need to do is modify B (perhaps using git rebase) so that it no longer depends on A, and resubmit the change to Gerrit.

how do I rebase / merge it?

git-review -d 1184 
git rebase origin/master
git status
<edit "both modified" files in status report>
git add <files>
git rebase --continue
git review

Find more useful information here about this kind of issue.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!