I saw this mistake happens more than once in our team. Let's say we have two branches: Dev and Prod. User switches to prod branch, commits a change, then, instead of doing 'git pull origin prod' to fetch the last changes on prod, he does by mistake 'git pull origin dev'. As a result, it merges dev branch into prod, which is not cool.
What I tried to do is to ask the developers not to use 'git pull origin branchname', instead, just use 'git pull'. (the local branch should be tracked to the remote for this..). Usually, this approach works well for us, yet, accidents might happen and I believe there is a way of avoiding it somehow.