How to make individual pull requests vs “stacking” them on top of each other in Github?

安稳与你 提交于 2019-12-22 10:59:45

问题


I'm not getting anywhere with this... trying to make 2 separate pull requests. Maybe someone can point me to what is wrong. Here is what I'm doing:

Fork repo FOO and clone to my machine

 git clone https://github.com/myself/FOO.git

Set upstream to track FOO

 git remote add upstream https://github.com/maker_of_FOO/FOO.git

Create new branch and checkout

 git branch FOO_fix_1
 git checkout FOO_Fix_1

Edit files and commit and push

 git commit
 git push

Push new branch to my fork of FOO

 git push -u origin FOO_fix_1

So far no problem. On Github I can click Compare and PR, which then creates the pull request on the master branch of FOO. My problem starts when I try to make the second PR, which should be an individual PR and not go on top of the first PR

Create a new branch:

 git branch FOO_fix_2
 git checkout FOO_fix_2
 git commit
 git push
 git push -u origin FOO_fix_2

This creates the new branch on my remote repo but now when I click Compare and PR on Github it compares my new branch FOO_fix_2 with Master but the PR will just be appended to my first PR.

Question:
Is it not possible to make separate PRs on the same Master branch of Foo? Because I'm fixing two different things in different branches. If everything is stacked back on master why should I bother with creating individual branches on my local version anyway?

Thanks for some clarification.


回答1:


You just need checkout the branch you started with in between each bunch of changes

So pull, to get you sync'd up.

checkout master if you aren't on that branch

Create a branch and do your stuff

then checkout master again, will get you back to where you were. So you end up with

Master->Branch1
Master->Branch2

instead of

Master -> Branch1 -> Branch2


来源:https://stackoverflow.com/questions/18160521/how-to-make-individual-pull-requests-vs-stacking-them-on-top-of-each-other-in

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