To have origin/master the same as master:
git push -f origin master:master
Discussion on the parameters:
-
-fis the force flag. Normally, some checks are being applied before it’s allowed to push to a branch. The-fflag turns off all checks. -
originis the name of the remote where to push (you could have several remotes in one repo) -
master:mastermeans: push my local branchmasterto the remote branchmaster. The general form islocalbranch:remotebranch. Knowing this is especially handy when you want to delete a branch on the remote: in that case, you push an empty local branch to the remote, thus deleting it:git push origin :remote_branch_to_be_deleted
A more elaborate description of the parameters could be found with man git-push
Opposite direction: If you want to throw away all your changes on master and want to have it exactly the same as origin/master:
git checkout master
git reset --hard origin/master