Question

I am new to git. I have forked another repository awhile back. I wanted a fresh start so I grabbed my private clone and then added a remote for the upstream repository. I can't pull from the repository because it says some files are not uptodate. I don't care about these files, I want everything from the upstream remote. Is there a way I can quickly resolve this?

Was it helpful?

Solution

To check out all files as they should be according to the repository, try either

git checkout -f

or

git reset --hard

Sometimes you may need to remove any untracked/ignored files which might conflict with things that have since been added upstream:

git clean -xdf

The -f tells clean to go ahead and remove the files (since this can be dangerous!), the -x tells it to delete ignored files too, and the -d tells it to delete entire untracked directories as well. To see what it's going to remove, change the -f to -n, for dry run.

OTHER TIPS

git checkout -f 

After that you can do a

git pull

Why not clone the upstream repository again, in another place on your local disk?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top