let\'s say that we have an hotfixes branch which was created from master. we added commits to hotfixes, but those commits were not use
The answers here are solid. I have needed this exact change when resetting my staging branch to master. In that case I want to both reset the origin to match master and also reset my local to match that. So here is a git alias that allows you to pass in the branch name and do both commands in one move. (It's a little dangerous)
reorient = "!f() { git push origin +master:$1 && git reset --hard origin/$1 ; }; f"
Then use it like:
git reorient hotfixes
The answers above were totally correct. But this will simply allow for fewer keystrokes and a quicker turnaround! Hope it helps.