I'm new to GIT and I want to how to avoid intermediate commits say D1-D2-D3 from develop getting added to master branch on git merge?
For e.g.
A-B-C(master) & D1-D2-D3-D4(develop) 
_on merge becomes_ 
A-B-C-D1-D2-D3-D4(master)
It should look like A-B-C-D4(master) on merge. Ideally I prefer A-B-C-E(master) where E is a new commit that is a merge commit, merge of develop onto master. 
I tried git merge --no-ff develop and though it adds the new commit however all the intermediate commits also gets added to master.
 
     
    