Personally, I don't think that the accepted answer is sufficient for the layman (and if you've been searching for this answer, you are a Git layman!!).
@jub0bs correctly describes the technical difference between the two. But there's no direction in his answer as to which you "should" use, or why.
There will always be exceptions of course, but in the general case you'll (ahem) always want to merge DEV into MASTER (scenario b in jub0bs answer).
Why?
To understand why, you need to dig a little deeper than the high-level timeline graph that jub0bs has the conversation at. Because at the end of both commits, when you look in your OS directory, you won't be able to tell the difference. The naive developer will therefore tell you that it doesn't matter which way round you merge the commits.
To see the difference, you need to look at the diff-tools (which should hopefully be built into your git-client (be that SmartGit, GitKraken, or whatever).
Let's imagine this file on MASTER branch:
filename: my_code.txt
some (code) { includes := feature1 + feature2 + feature3; }
And on DEV branch we have a bug-fix that was included :
filename: my_code.txt
some (code) { includes := feature1 + feature2 + bug-fix; }
After the merge-commit (regardless of which way around you do it), you'll have:
filename: my_code.txt
some (code) { includes := feature1 + feature2 + bug-fix + feature3; }
You'll only see the difference in your Git-client.
If you merge MASTER into DEV (as per scenario c) your Git-client will tell you that bug-fix
was always there as part of the main history of the file, and that at some point someone came along to wedge-in feature3
(almost as an after-thought). But any half-decent coder would tell you that logically, this is an incorrect interpretation of history!
What you really want to do is merge DEV into MASTER. In this scenario, the history will tell you that feature1
, feature2
and feature3
were always in-scope and planned as the main development trunk of the overall project. bug-fix
on the other hand, was only added as a necessary correction (after-thought or distraction) along the way.