简体   繁体   English

Git在Github上的pull请求中合并

[英]Git merge in a pull request on Github

I have a branch called hotfix (branched from the master branch) for which I opened a pull request on Github. 我有一个名为hotfix的分支(从master分支分支),我在Github上打开了一个pull请求 The request page said that the hotfix branch is not up to date and provided me an option to Update Branch . 请求页面表示hotfix分支不是最新的,并为我提供了Update Branch的选项。 On clicking this option, it says Merging branch 'master' into hotfix . 单击此选项时,它会将Merging branch 'master' into hotfix

So I just wanted to ask that the master branch will remain as is, right? 所以我只想问master分支将保持原样,对吧? The wording above is a little ambiguous to me. 上面的措辞对我来说有点模棱两可。 If not, what is the right way to do it on the Github UI? 如果没有,在Github UI上执行此操作的正确方法是什么?

Yes that is equivalent to the following set of commands, if you were trying to do this locally: 是的,这相当于以下命令集,如果您尝试在本地执行此操作:

git checkout hotfix  // hotfix is behind master by some number of commits       
git merge master

Which just synchronizes your hotfix branch, but leaves the master branch intact. 这只是同步您的修补程序分支,但保持主分支完整。 It will grab the changes from master, which aren't in your branch, into your branch: 它将从master中的更改(不在您的分支中)中获取到您的分支中:

https://help.github.com/articles/syncing-a-fork/ https://help.github.com/articles/syncing-a-fork/

The language "merging X into Y" means that any new commits which are present on X, but aren't on Y will be added after all the commits currently on Y. Or, if you currently have: “将X合并为Y”这一语言意味着在X上存在但不在Y上的任何新提交将在当前在Y上的所有提交之后添加。或者,如果您当前具有:

master:    A - B - C - D - E
               \
hotfix:          X - Y - Z

After merging master into hotfix , you'll have: master合并到hotfix ,你将拥有:

master:    A - B - C - D - E
               \           \
hotfix:          X - Y - Z - C - D - E

Yes, the master branch will remain as is. 是的,主分支将保持原样。 It is just your branch "hotfix" which is again updated with the latest master branch code. 它只是您的分支“修补程序”,它再次使用最新的主分支代码进行更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM