将拉取请求合并在一起 [英] Merging pull requests together
问题描述
有人已经在github上向我的仓库提交了一组pull请求。不幸的是,他们已经在几次拉取请求(每个文件一次)中完成了这项工作,而不是一次性提交所有文件的所有拉取请求。
请求他将它们合并为一个 - 而没有得到任何回应我现在试图在Git Bash中将这些请求合并到一起 - 但运气不错 - 我很高兴使用合并按钮并通过Windows上的GitHub程序进行提交但更多。我没有真正理解git shell - 所以如果有人可以通过我如何将这些pull请求合并在一起的过程(无论如何都不会发生冲突),那将是非常值得赞赏的。
<如果你有3个pull请求A,B,C,它们位于三个分支bA,bB,bC上。并且您的主分支是主人。
首先将所有分支转到您的本地仓库,而不合并它。
git fetch his-repo
现在您的仓库可能有四个分支: master,bA,bB,bC
我将创建一个名为 f-merge-his的分支-repo
git checkout master
这确保f- merge-his-repo从master分支出来。
git checkout -b f-merge-his-repo
这会创建分支f-merge-his-repo并切换到它。
所以现在你正在使用f-merge-his-repo,使用以下命令:
git merge bA
git merge bB
git merge bC
如果存在冲突,您应该修复它(手动或使用mergetool),但正如您所说的那样没有冲突,所以我们说 bA bB和bC 现在都在
f-merge-his-repo中
然后,只需简单地合并 f-merge-his-repo
到你的主麸皮中ch
您应该先切换到主分支。
git checkout master
然后合并f-merge-his-repo
git merge f-merge-his-repo
或者如果您更喜欢没有快进合并
git merge --no-ff f-merge-his-repo
毕竟,删除这些分支。 p>
git分支-d bA
git branch -d bB
git branch -d bC
git branch -d f-merge-his-repo
你应该看看 最后提示: 一种记住的好方法 Merge is合并另一个分支 TO 您当前的分支(当然,您可以命名两个分支,但默认语法是将分支合并到您当前的分支中) 所以你应该总是切换到主分支并合并其他分支 并且rebase将重新定位您当前的分支 ON 另一个分支(通常是主分支) p> Someone has submitted a set of pull requests to my repository on github. Unfortunately they've done this in several pull requests (one for each file) rather than submitting all the pull request for all the files in one go. After requesting him to merge them as one - and not getting any response I'm now trying to merge these pull requests together myself in the Git Bash - but having little luck - I'm quite happy using the merge buttons and making commits through the GitHub program on windows but little more. I have no real understanding of the git shell - so if someone could go through the process of how I can merge these pull requests together (none of them conflict in anyway) it would be much appreciated. Say if you have 3 pull requests A,B,C which are on three branches bA,bB,bC. and your main branch is master. First get all of his branches to your local repo without merging it.
so now your repo may have four branches: I will create a branch from master called So now you are currently on f-merge-his-repo, use the following commands: If there are conflicts you should fix it(manually or using a mergetool), but as you said there are no conflicts, so we say that then, just simply merge You should first switch to the master branch.
And then merge f-merge-his-repo
or if you prefer a none fast forward merge
After all, delete these branches. You should really take a look at Last tip: A good way to remember Merge is merging another branch TO your current branch (of course you can name both branches, but the default syntax is merge the branch to your current branch) so you should always switch to the main branch and merge others branch And rebase is rebasing your current branch ON another branch(usually the main branch) 这篇关于将拉取请求合并在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! pro-git
这里一>。这是一本简单的书,它向你展示了你在日常工作中需要的所有东西,相信我,一旦你使用了git bash,你会发现所有这些git GUI都很沮丧(除了查看日志,我使用gitk来查看并分析日志)
git merge
和 git rebase
就像
git checkout master
git merge their-branch --no-ff
或
git merge他们的分支
git checkout feat ure-branch
git rebase master
git fetch his-repo
master, bA, bB, bC
f-merge-his-repo
git checkout master
This makes sure that f-merge-his-repo branches out from master.git checkout -b f-merge-his-repo
This creates the branch f-merge-his-repo and switch to it.git merge bA
git merge bB
git merge bC
bA bB and bC
are now all in f-merge-his-repo
f-merge-his-repo
into your master branchgit checkout master
git merge f-merge-his-repo
git merge --no-ff f-merge-his-repo
git branch -d bA
git branch -d bB
git branch -d bC
git branch -d f-merge-his-repo
pro-git
here. It is a simple book which shows you everything you need with git in your daily work, and believe me, once you get used of git bash, you will find all of these git GUI's frustrated(except viewing the log, I use gitk to view and analyse the log)git merge
and git rebase
is likegit checkout master
git merge their-branch --no-ff
or
git merge their-branch
git checkout feature-branch
git rebase master