Resetting master branch to origin master
Sometimes your local master branch gets into a state where it has diverged from origin/master. This can happen when you accidentally commit to master instead of a feature branch, or when a rebase goes wrong.
To reset your local master branch to match origin/master, first fetch the latest state from the remote:
git fetch origin
git reset --hard origin/master
master pointer to the same commit as origin/master and updates your working directory to match.
Warning: git reset --hard will discard all uncommitted changes and local commits that are not on the remote. If you have work you want to keep, stash it first with git stash or create a backup branch:
git branch backup-master
git reset --hard origin/master
backup-master branch in case you need them later.