How to Overwrite Local Files with Git Pull.

If you feel the need to discard all your local changes and just reset/overwrite everything with a copy from the remote branch, then you should follow this guide.

Important: If you have any local changes, they will be lost. With or without –hard option, any local commits that haven’t been pushed will be lost.

If you have any files that are not tracked by Git (e.g. uploaded user content), these files will not be affected.

The Overwrite workflow:
To overwrite your local files do:

git fetch --all
git reset --hard <remote>/<branch_name>

For example:

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

This will give message like below

HEAD is now at f2**a6* adding last_commit_name

Thanks for reading.

Keep Coding.