How to Override Local Files with Git Pull
2 min read

Override your local project

If you need to discard all your local changes and just fetch the latest update from your git repository, this is the simplest way to do that. Remember that all local changes will be lost, so it would be recommended to stash them or save them in another branch.

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

For example, it could look like this:

git fetch --all
git reset hard origin/master

git fetch downloads all the latest changes without trying to merge or rebase anything. The git reset resets your active branch to the latest from your remote repository.