Tim
Tim

Reputation: 99606

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

tim  wants to merge 5 commits into master from feature

Then I resolved some merge conflict, and GitHub showed that

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? How shall I understand the two contradictory statements on GitHub?

Thanks.

Upvotes: 2

Views: 463

Answers (2)

Code-Apprentice
Code-Apprentice

Reputation: 83587

A pull request is an attempt to merge your feature branch into the project's master branch. 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. 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".

Upvotes: 1

anthony sottile
anthony sottile

Reputation: 70243

You probably resolved some merge conflicts when merging with 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.

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. 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. More information on what "fast forward" means

At the end, the master branch history will look something like:

master A - E - B - F - C

Upvotes: 2

Related Questions