git pull analogous to / opposite of git push -f?

ma11hew28 picture ma11hew28 · Aug 1, 2011 · Viewed 8.3k times · Source

Sometimes, esp. when I'm the only one working on a remote repository, I like rewriting the history with git rebase -i and git push origin master -f.

How do I do a forced git pull origin master without a merge? I tried it with the -f option, but that didn't work. I just want to rewrite the history of my local git repo to match that of the remote (origin).

Answer

ma11hew28 picture ma11hew28 · Aug 1, 2011
git fetch
git reset --hard origin/master