如何在第一次合并后提交另一个拉取请求? [英] How do I submit another pull request once the first one was merged?

查看:134
本文介绍了如何在第一次合并后提交另一个拉取请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我分叉了一个公共的Github仓库,将fork克隆到本地仓库,做了一些修改,将它们推送到fork的主分支。然后我打开了一个pull请求,它被合并到原始的repo中。



现在我想进行下一个更改。我在本地执行它们,推送到我的分支主分支并尝试打开另一个请求。 Github将新的更改和先前合并的更改显示为属于此新的请求。显然,我只想要列出新的更改。



我做错了什么,我该怎么做对不对?

将它们推送到我的fork的主分支中

这可以使您的下一个拉取请求很难合并。你现在应该做的是:

$ g $ g $ git checkout master
git pull --rebase upstream master
code>

其中上游是原始回购,以获得 master 分支符合其 master rebase 可能需要手动编辑。现在,要提交一个pull请求, branch off master:

  git checkout -b new-branch 
#编辑编辑
git push origin new-branch

并提交a从你的新分支拉取请求。这样,您的 master 分支与原始仓库保持同步。



如果您的 master 不在上游 master 中,请确保将它们放在单独的分支中,然后 git reset --hard master 分支。


I forked a public Github repository, cloned the fork to a local repo, made some changes, pushed them to the master branch of my fork. Then I opened a pull request and it was merged into the original repo.

Now I want to make next changes. I do them locally, push to the master branch of my fork and try to open another pull request. Github shows both the new changes and the previously merged changes as belonging to this new pull request. Clearly I only want the new changes listed.

What am I doing wrong and how do I do it right?

解决方案

pushed them to the master branch of my fork

This can makes your next pull request hard to merge. What you should do now is

git checkout master
git pull --rebase upstream master

where upstream is the "original" repo, to get your master branch in line with its master. The rebase may take manual editing. Now, to submit a pull request, branch off master:

git checkout -b new-branch
# edit edit edit
git push origin new-branch

and submit a pull request from your new branch. This way, your master branch stays in sync with the original repo's.

If you still have commits in your master that are not in upstream's master, make sure you put those in a separate branch, then git reset --hard the master branch.

这篇关于如何在第一次合并后提交另一个拉取请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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