Why is Git merge creating multiple commits on master branch?

Viewed 3293

There are two branches I am working with, master and newFeature. While building the "new feature", I added multiple commits to the newFeature branch. My understanding of git merge is that it will create a single commit on master once the branches are merged, however when merged, master now has the full commit history that is on newFeature. For example-

master (pre-merge):

    1=>2=>3

newVersion:

    1=>2=>3=>4=>5=>6

master (actual results of merge):

    1=>2=>3=>4=>5=>6

master (expected results of merge):

    1=>2=>3=>6

Is there any way to remove the intermediary commits from newVersion during the merge, and why isn't merge working as expected?

2 Answers
Related