I have been working in PhpStorm on a dedicated branch, but when pushing to github, I inadvertently merged to the master branch.
How would I undo the merge both in github and locally? The github master is used to migrate code to various servers so I need to rollback to the previous commit prior to the merge rather than create a new commit with my changes undone.
You need to reset the head to the commit just before your current head.
git reset --hard <commit_before_merge>
E.g. git reset --hard master^