在上次提交尚未合并的同一分支上创建新的合并请求
Make a new Pull Request on the same branch where the last commit hasn't been merged yet
好的...情况是这样的:
- 我分叉了一个存储库
- 我创建了一个新分支。分支名称是
configs
- 我提交了一些更改并提出了拉取请求 #1
- 拉取请求 #1 仍在审查中,尚未合并到基础存储库中
- 我又做了一些改动。仍在
configs
分支中。但这个新变化不影响以前的变化(不同的文件)
- 我做了一个新的提交,当然它还在
configs
brach
- 当我查看 github 时,这个新提交将转到上一个拉取请求,拉取请求 #1。
嗯,我的问题是"How do you make this new commit as a new pull request or lets say pull request #2 but still in the same brach?"
谢谢。
将你的第二次提交放在另一个分支上
# now
A---B---C <<< main-line
\
D---E <<< configs
# target
A---B---C <<< main-line
\
D <<< configs
\
E <<< configs-plus
要做到这一点,一步一步来:
# start from branch configs
git checkout configs
# Create the new branch (by default, it'll point at HEAD, so configs)
git branch configs-plus
# reset current branch (still configs) to last commit
git reset --hard @^
# finally, push (--force (or -f) needed because history has been rewritten)
git push -f origin HEAD
然后创建一个新的 PR configs-plus > main-line
。第一个 PR 将通过强制推送更新以删除第二个提交。
好的...情况是这样的:
- 我分叉了一个存储库
- 我创建了一个新分支。分支名称是
configs
- 我提交了一些更改并提出了拉取请求 #1
- 拉取请求 #1 仍在审查中,尚未合并到基础存储库中
- 我又做了一些改动。仍在
configs
分支中。但这个新变化不影响以前的变化(不同的文件) - 我做了一个新的提交,当然它还在
configs
brach - 当我查看 github 时,这个新提交将转到上一个拉取请求,拉取请求 #1。
嗯,我的问题是"How do you make this new commit as a new pull request or lets say pull request #2 but still in the same brach?"
谢谢。
将你的第二次提交放在另一个分支上
# now
A---B---C <<< main-line
\
D---E <<< configs
# target
A---B---C <<< main-line
\
D <<< configs
\
E <<< configs-plus
要做到这一点,一步一步来:
# start from branch configs
git checkout configs
# Create the new branch (by default, it'll point at HEAD, so configs)
git branch configs-plus
# reset current branch (still configs) to last commit
git reset --hard @^
# finally, push (--force (or -f) needed because history has been rewritten)
git push -f origin HEAD
然后创建一个新的 PR configs-plus > main-line
。第一个 PR 将通过强制推送更新以删除第二个提交。