How to force Git pull and overwrite local changes

1. Discard local changes

git reset --hard HEAD

2. Retrieve the latest remote code

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

Scroll to Top