Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do PRs with git 'squash and merge' option do not appear to merge with master?

Tags:

git

GitHub has several options for merging a Pull Request. One is to Squash and merge. When this option is chosen, all intermediate commits are squashed before merging. The odd thing is that in the network graph (insights tab), the branch (from which the Pull Request was created) does not appear to merge into master. You see the same thing if you use Sourcetree.

enter image description here

Instead of selecting, Squash and merge if you choose to the Merge pull request option, you see the branch merging with master.

enter image description here

Why does this happen? I would've expected the branch to merge with master after squashing intermediate commits in the Squash and merge operation as well.

like image 894
Prachi Avatar asked Mar 26 '18 18:03

Prachi


People also ask

How do I enable squash merge in GitHub?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Pull Requests", select Allow squash merging. This allows contributors to merge a pull request by squashing all commits into a single commit.

Should you squash commits when merging into master?

3 Answers. Show activity on this post. In my opinion, and bear in mind, this is just an opinion, and you will likely get different answers, you should NOT squash the commits when merging into master from the develop branch. Doing so would lose a lot of the history of the changes that have been made.

What is the difference between merge and squash and merge?

Squash merging is a merge option that allows you to condense the Git history of topic branches when you complete a pull request. Instead of each commit on the topic branch being added to the history of the default branch, a squash merge adds all the file changes to a single new commit on the default branch.


1 Answers

The graphical tools that are drawing the merge arrow are looking for a 'merge commit'. Using the 'squash and merge' option on Github does not create a merge commit (it is 'squashed').

More information about the different merge methods on GitHub: https://help.github.com/articles/about-merge-methods-on-github/

like image 172
Max Friederichs Avatar answered Oct 21 '22 11:10

Max Friederichs