Relationship of 'base' and 'master'.

This is a noob question (from techwriter with little Git experience using GitHub to build a documentation site.)

I have created a branch called ‘reviews’, which is the destination for the Edit Me button on the site pages. This workflow is intended to accomodate user reviews of any of the pages, so that site admin (me) can then review and merges changes into the default branch, which is master. As the site admin, I’m making changes directly to master.  (Incidentally I also intend to protect this branch so that other admins/users can’t merge/delete it.)

So far, so good.

This morning, I logged into GitHub and selected the review branch. Predictably, it says ‘This branch is 39 commits behind master.’ So I click on Pull Request to initiate a merge i.e. bring review up-to-date with master.

What is confusing to me is this window:

So here, the ‘base’ is set to ‘master’, and I want to compare ‘master’ with ‘review’.  But to do that, I find I need to set ‘base’ to be ’ review’, and ‘compare:’ to ’ master’. Then  I see the ‘Able to be merged’ and am able to enter a commit comment. 

The reason I’m confused is the ambiguity of the relationship between ‘base’ and ‘master’.  I expected the ‘base’ to be equivalent to ‘master’ so that when a branch is being compared to it, it will display variances between ‘master’ and the other branch (in this case, ‘review’). So this seems counter-intuitive to me. 

In any case, if I now go ahead and create a pull request, enter a comment (i.e. 'merging 39 changes for [date range]) then the result will be, the changes in master branch will be updated to review.

Is there anything in the documentation specifically about this issue? I have been looking around and there’s a lot that’s sort of relevant,  without making this exact point. 

1 Like

Hi @texterity,

The Github UI says it right “This branch is 39 commits behind master” , there are changes on master and not in the review branch so there are nothing to merge to master.

Assume the following history:

                      A review
                    /
               A—B---C—D master

The branch review is created from the commit A of master while master continue to grow with some more commits B C D. In the review branch will not be add any more commits. Now you want to merge review into master, but the master had already the commit A so the review is up-to-date with master. If you want the commits made on master you need to do the exact opposite: merge the master into review. In this case you put all the commits made on master into review. The example below become:

                 

                     A—B---C—D review
                    /                /
               A—B---C—D master

As a matter of fact, I try to do this in your repository and this is the result:

What is confusing to me is this window:

 

So here, the ‘base’ is set to ‘master’, and I want to compare ‘master’ with ‘review’.  But to do that, I find I need to set ‘base’ to be ’ review’, and ‘compare:’ to ’ master’. Then  I see the ‘Able to be merged’ and am able to enter a commit comment. 

 

The reason I’m confused is the ambiguity of the relationship between ‘base’ and ‘master’.  I expected the ‘base’ to be equivalent to ‘master’ so that when a branch is being compared to it, it will display variances between ‘master’ and the other branch (in this case, ‘review’). So this seems counter-intuitive to me.

To explain more, the pull request is not a compare of file but a compare changes made by commits. If you imagine  the repository is not made by files but by commits is no more counter-intuitive.

Is there anything in the documentation specifically about this issue? I have been looking around and there’s a lot that’s sort of relevant,  without making this exact point. 

You cannot find anything about this because there are no issues about that.

Hope this helps :slightly_smiling_face:  

-Gabriele-

Mark helpful posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great content!

2 Likes

Thanks, Gabriele

To explain more, the pull request is not a compare of file but a compare changes made by commits. If you imagine  the repository is not made by files but by commits is no more counter-intuitive.

 

 Hope this helps :slightly_smiling_face:  

 

-Gabriele-

 

That is the concept that I was missing. Now that you have explained it so well, it makes perfect sense.

3 Likes