git overwrite local changes

C++
git reset --hard origin/master
# if working with newer repos where 'master' is now 'main'
git fetch --all
git reset --hard origin/main git fetch --all
git reset --hard origin/master
Source

Also in C++: