Search code examples
gitgithubgit-mergepull-request

Does github automatically merges the PR to the parent branch also?


I never faced any issue in git and github regarding the PR. Today a very strange thing happened.

There were 3 branches. Master, Beta_A and Beta_B.

Both Beta_A and Beta_B were made out of Master and they use to give PR to Master only. Today for one occasion I pulled the Beta_B branch for some early code. I merged Beta_B branch to my Beta_A branch. After some additional change I raised the PR to Master from my Beta_A branch.

After merging the PR to Master, one additional commit was made which merged Master into Beta_B branch. I have never noticed anything happening like this.

Any specific reasons why did this happened?


Solution

  • The documentation mentions that

    Pull requests are merged using the --no-ff option, except for pull requests with squashed or rebased commits, which are merged using the fast-forward option.

    Since B was merged in A, GitHub consider that B PR has in effect been merged to master (through A PR being merged to master): it marks that PR (B) completion with a no-ff merge commit.