Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

github

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.

like image 630
Chris Avatar asked Oct 18 '25 14:10

Chris


2 Answers

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.

like image 189
Igor Avatar answered Oct 21 '25 02:10

Igor


Just git pull --all should get the newest stuff.

like image 21
vonbrand Avatar answered Oct 21 '25 04:10

vonbrand