How do I overwrite my local repo with the one on github?

git, github

Solution

I think you should be able to do a fetch on all the files, then reset them to the origin:

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

You could probably do it in either order, too.

If you want to remove any files you have added that aren't tracked, do a clean too:

git clean -f

The advantage to this approach over cloning to a new directory is that you will still retain some of the history/reflog. If you absolutely do not care that data though, then either approach is fine.

Problem

I've got an out-of-date repo with nothing to add on my machine. I want to pull in the latest stable branch from github. Should I just clone over it? I'm not sure.

Original source