简体   繁体   English

功能分支是否合并到主分支,或相反?

[英]Is a feature branch merged into the master branch, or the opposite?

On GitHub, after I created a pull request from my feature branch, Github showed that 在GitHub上,在我从我的功能分支创建了一个拉取请求之后,Github展示了这一点

tim  wants to merge 5 commits into master from feature

Then I resolved some merge conflict, and GitHub showed that 然后我解决了一些合并冲突,GitHub表明了这一点

Merge branch 'master' into feature

Now I am confused, because the pull request I created is for merging my feature branch into the master branch. 现在我很困惑,因为我创建的拉取请求是将我的功能分支合并到主分支中。 Why does GitHub said the opposite? 为什么GitHub说相反? How shall I understand the two contradictory statements on GitHub? 我如何理解GitHub上的两个相互矛盾的陈述?

Thanks. 谢谢。

You probably resolved some merge conflicts when merging with github. 您可能在与github合并时解决了一些合并冲突。 github shows resolution of merge conflicts on the feature branch itself (generally a best practice when resolving conflicts is to resolve them in the feature branch) and then merged the feature branch into master. github显示功能分支本身的合并冲突解决方案(通常是解决冲突时的最佳实践是在功能分支中解析它们),然后将功能分支合并到主服务器中。

Here's a diagram: 这是一个图表:

master  A - B - C
         \   \ /
feature   E - F

The F commit (where conflicts where resolved) is the Merge branch 'master' into feature commit. F commit(解决的冲突)是Merge branch 'master' into feature提交。 The C commit (if it exists -- github may choose to fast-forward your feature branch onto master) is the merge of the feature branch into master. C提交(如果存在 - github可以选择将您的功能分支快进到主服务器上)是将功能分支合并到主服务器中。 More information on what "fast forward" means 关于“快进”意味着什么的更多信息

At the end, the master branch history will look something like: 最后,主分支历史记录将类似于:

master A - E - B - F - C

A pull request is an attempt to merge your feature branch into the project's master branch. 拉取请求是尝试将您的功能分支合并到项目的master分支中。 Often, there will be merge conflicts that must be resolved manually. 通常,必须手动解决合并冲突。 When you do so, you should merge the current master into your feature branch. 执行此操作时,应将当前master合并到功能分支中。 The commit message you see will say exactly this. 您看到的提交消息将准确地说明这一点。 When the Pull Request is finalized, then you will also see a commit with the message "Merge Pull Request #XYZ from user/branch". 完成Pull Request后,您还会看到一条提交消息“Merge Pull Request #XYZ from user / branch”。

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

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