How to force pull and overwrite local files in git

1 min read

  1. First, update all origin/branch refs to latest:
git fetch --all
  1. Backup your current branch (e.g. master):
git branch backup-master
  1. Jump to the latest commit on origin/branch and checkout those files:
git reset --hard origin/master

References: stackoverflow