Assuming you were in your own topic branch. If you want to merge the last 2 commits into one and look like a hero, branch off the commit just before you made the last two commits (specified with the relative commit name HEAD~2).
git checkout -b temp_branch HEAD~2
Then squash commit the other branch in this new branch:
git merge branch_with_two_commits --squash
That will bring in the changes but not commit them. So just commit them and you're done.
git commit -m "my message"
Now you can merge this new topic branch back into your main branch.