How do I submit another pull request once the first one was merged?

馋奶兔 提交于 2019-12-02 19:17:19

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/18053860/how-do-i-submit-another-pull-request-once-the-first-one-was-merged

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