没有未提交的提交的新请求 [英] New pull request without unmerged commits
问题描述
我在存储库上有一个拉取请求。提交仍未被合并。现在,我想提出另一个拉取请求,完全独立于前一个请求。当我创建一个新的分支并进行新的提交时,所有未提交的提交也与新提交一起!
我不想创建新的请求未提交的提交。请帮助我如何做,因为我是新来的git:)
当我创建一个新的分支并进行新的提交时,这是你的问题的根源。
不应将提交添加到相同的功能分支,而应该从当前功能的父项创建一个新分支并从那里提交。假设父分支是 master
,并且特性分支有3个提交。图表看起来像这样:
master:... A - B - C
\
功能:M - N - O
当您从 feature
,并开始添加新的提交,最终以此为结果:
master:。 .. A - B - C
\
功能:M - N - O
\
new_ft:S - T ...
换句话说,特征
的历史是新的分支。相反,您可以使用以下命令从 B
commit中的 master
创建一个新分支。
git checkout -b new_feature< SHA-1 for commit B>
现在创建另一组提交,然后这个第二个请求将基本上独立于第一个一个。
I have a pull request on a repository. The commits are still unmerged. Now, I want to make another pull request, totally independent from the previous one. When I create a new branch and make the new commits, all of the unmerged commits are also alongside with the new ones!
I want to create a new pull request without the unmerged commits. Please help me on how should I do that as I'm new to git :)
When I create a new branch and make the new commits
This is the source of your problem. Instead of adding commits to the same feature branch, you should create a new branch from the current feature's parent and commit from there. Let's say the parent branch is master
and the feature branch has 3 commits in it. The diagram would look like this:
master: ... A -- B -- C
\
feature: M -- N -- O
When you created a new branch from feature
and started adding new commits you ended up with this:
master: ... A -- B -- C
\
feature: M -- N -- O
\
new_ft: S -- T ...
In other words, the history of feature
is part of the new branch. Instead, you can create a new branch from the B
commit in master
using:
git checkout -b new_feature <SHA-1 for commit B>
Now make your other set of commits, and then this second pull request will be essentially independent from the first one.
这篇关于没有未提交的提交的新请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!