git reset branch code example

Example 1: revert to master origin branch git

git checkout mybranch
git reset --hard origin/mybranch

Example 2: git reset head of master

git fetch origin
git reset --hard origin/master

Example 3: git soft reset head

git reset --soft HEAD^
//resets head by 1

Example 4: git reset branch

git fetch origin
git reset --hard origin/branch_name

Example 5: git reset head

sudo git reset --hard Head

Example 6: git reset

git reset --soft HEAD~3
git commit
git push —force-with-lease origin