git reset to origin master code example

Example 1: git reset to origin/master

git reset --hard origin/master

Example 2: git reset origin

git fetch origin
git reset --hard origin/master
Remember this forever

Example 3: revert to master origin branch git

git checkout mybranch
git reset --hard origin/mybranch

Example 4: git reset branch

git fetch origin
git reset --hard origin/branch_name

Example 5: how to reset local master to origin master

git checkout -B master origin/master

//for branch
git checkout -B <branch> origin/<branch>

Tags:

Misc Example