git override local branch with remote code example

Example 1: how to pull and overwrite local changes git

git fetch --all
git reset --hard origin/master

Example 2: git replace local branch with remote

git fetch
git reset --hard origin/{{branch}}
# replace {{branch}} with name

Example 3: git replace local branch with remote

git reset --hard origin/master

Example 4: how to pull the changes from git without staging local changes

git stash save
git pull
git stash pop

Example 5: oevrride localwith remote branch

git reset --hard origin/master