本文介绍了如何进行个别拉取请求与“堆叠”他们在Github的互相顶部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有得到这个...试图做出2个独立的拉请求。也许有人可以指出我错了什么。以下是我正在做的事:

Fork repo FOO并克隆到我的机器上

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

设置上游跟踪FOO

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

创建新的分支并结帐

  git branch FOO_fix_1 
git checkout FOO_Fix_1

编辑文件并提交并推送 p>

  git commit 
git push

将新分支推送到我的FOO分支中

  git push -u origin FOO_fix_1 

到目前为止没有问题。在Github上,我可以点击 Compare和PR ,然后在<$ c $的 master 分支上创建pull请求C> FOO 。当我尝试创建第二个PR 时,我的问题就开始了,它应该是一个单独的PR,并且不会在第一个PR之上



创建一个新分支:

  git分支FOO_fix_2 
git checkout FOO_fix_2
git提交
git push
git push -u origin FOO_fix_2

这会创建新的分支在我的远程回购,但现在当我点击比较和PR 在Github上它比较我的
新分支 FOO_fix_2 with Master ,但公关只会附加到我的第一个公关。



问题

是不可能在 Foo 的同一 Master 分支上创建单独的PR, ?因为我正在修复两个不同的分支。如果所有东西都堆放在主人身上,为什么我应该在本地版本上创建个别分支呢?



感谢您的澄清。

您只需在每次更改之间签出您开始使用的分支



因此,拉到让你同步起来。



如果你不在那个分支上,checkout master

创建一个分支并做好你的工作然后重新结算主人,会让你回到原来的位置。所以你最终得到了

pre $ code Master-> Branch1
Master-> Branch2


$ b

而不是

  Master  - > Branch1  - > Branch2 


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 mynew 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.

解决方案

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

这篇关于如何进行个别拉取请求与“堆叠”他们在Github的互相顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 01:48