How to do git pull -f
Where
git pull --force
like in rm -rf
and then git clone
again from scratch?
The end result should be git diff
returning nothing.
In addition to the other answers, I would also add git clean -fdx
to remove all non-reproducible files and directories to avoid potential problems with adding files to the remote repository, but also present in the current clone.
git clean -fdx
git fetch
git reset --hard origin/master
You use git fetch
to fetch everything from a remote repository. Then you can just git reset --hard origin/master
before reset point the current branch to the original master and reset the working directory.
Reset your working directory will revert back to the last click:
git reset --hard
Then pull as usual