How can I get same HEAD for master and dev after merge?
You can't. Well, technically you could, but you probably don't want to.
A branch in git points to a commit; that commit points to other commits, back through history. Each of those commits is identified by a unique hash; if two different commits had the same hash, everything would be horribly broken. That hash covers both the contents of the repository, and all the metadata of the commit, including what parents it has.
So if two different branches point at the same hash, those branches are identical - not just identical in their current content, but identical in their entire history.
The only way for that to happen is to always use "fast-forward" merges, everywhere, so that all your branches are actually just pointers in a single line of commits. In practice, that means rebasing things, a lot - for instance, every hotfix will probably require rebasing the whole of develop, and then rebasing all open feature branches onto that new develop.
That's a lot of work, and a lot of things that can go wrong, to avoid this:
I had to merge an empty commit with no diff.
Git was smart enough to recognise that no actual changes were needed, even though you'd merged two unrelated commits (remember: a squash merge throws away all history on the feature branch). That is it solving the problem for you.
The other solution, as pointed out in comments, is not to merge the feature to two places in the first place. Merge release to master, and then merge master to develop.