由于被放弃的提交,Git合并等待 [英] Git merge pending due to an abandoned commit
问题描述
我有两个提交。提交B取决于提交A.提交A被放弃。现在我得到合并B的错误。它表示提交,由于B依赖于A,合并等待。
我搜索了一下,但无法找到确切的答案。我需要一步一步的解决方案,因为我是git的新手,并且很难理解如何解决这个问题。
这就是发生了什么。
-
git在本地提交A。
。 -
A被遗弃了,但是我的本地git已经提交了A。
git 在本地为同一分支中的B提交(使B依赖于A)。 > -
现在B并没有合并,因为A被放弃了。
合并B和我想要依赖于A删除。现在希望它清楚!
这是服务器错误:
更改1184 - 已提交,合并待定
在评论中:
Gerrit Code Review
由于缺少依赖关系,无法合并更改。
下面的变化也必须提交:
(commit-id,这已被放弃)
工作?如果是这样,怎么做?
有几种方法可以解决您的问题。挑选你感觉最舒服的一个。
以下是一个:
-
git checkout yourbranch
(确保您位于右分支) -
git reset --hard A ^
(在A之前重置所有内容) ) -
git log
(确认它是你想要的)
-
git push --force
(可能需要根据您通常推送的方式指定其他选项)
下面是另外一个,结果相同:
-
git checkout yourbranch code>(确保你在正确的分支)
-
git rebase --onto A ^ A
在A之前的提交之后,有效地删除A)
git log
(确认它是你想要的)
git push --force
(可能需要指定其他选项取决于您通常推送的方式)
以下是第三个结果,仍等同:
-
git checkout yourbranch
(确保您位于右侧分支) -
git rebase --interactive A ^
(将打开您的编辑器)
- 删除显示提交A的行,保存并关闭 li>
-
git log (确认它是你想要的)
-
git push --force
(可能需要根据您通常推送的方式指定其他选项)
I have two commits. Commit B depends on commit A. Commit A was abandoned. Now I am getting error for merging B. It says submitted, merge pending due to dependency of B on A.
I have googled around but cant find an exact answer. I need step by step solution as I am a novice in git and am finding hard to understand how to resolve this.
This is what happened.
git commit in local for A.
git push for A in remote.
A got abandoned, but my local git has commit A.
git commit in local for B in same branch (Makes B dependent on A).
git push B in remote in same branch.
Now B is not merging since A is abandoned.
I need to merge B and I want dependency on A removed. Hope its clear now!
Here is Server error:
Change 1184 - Submitted, Merge Pending
In comments:
Gerrit Code Review
Change could not be merged because of a missing dependency. The following changes must also be submitted: (commit-id, which was abandoned)
Will rebase work? If so, how to do it?
There are several ways to fix your problem. Pick whichever you feel most comfortable with.
Here is one:
git checkout yourbranch
(make sure you are on the right branch)git reset --hard A^
(reset everything to the commit before A)git cherry-pick B
(where B is the hash of the commit you want to keep)git log
(confirm that it is what you wanted)git push --force
(may need to specify other options depending on how you usually push)
Here is another, result is equivalent:
git checkout yourbranch
(make sure you are on the right branch)git rebase --onto A^ A
(rebase everything after A on top of the commit before A, effectively removing A)git log
(confirm that it is what you wanted)git push --force
(may need to specify other options depending on how you usually push)
Here is a third, result still equivalent:
git checkout yourbranch
(make sure you are on the right branch)git rebase --interactive A^
(will open up your editor)- Delete the line showing commit A, save and close
git log
(confirm that it is what you wanted)git push --force
(may need to specify other options depending on how you usually push)
这篇关于由于被放弃的提交,Git合并等待的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!