git pull force update code example
Example 1: git force pull
git fetch --all
git reset --hard origin/master
Example 2: git pull hard
git reset --hard origin/master
Example 3: force pull git
# WARNING: this can't be undone!
git reset --hard HEAD
git clean -f -d
git pull
Example 4: force pull git
git reset --hard HEAD
git pull
Example 5: force git pull overwrite
# if working with newer repos where 'master' is now 'main'
git fetch --all
git reset --hard origin/main