I have been reading the various answers to my question, and the usual reset examples are not working. I have a git repository that is behind its remote. Resetting from the various examples I have read does not work. The remote is a true, accurate repository, and it can overwrite what I have.
How can I overwrite git completely and make sure the files on the remote and local -- it is the local that needs overwriting -- are the same?
CodePudding user response:
The easiest solution is to just throw away the existing local git repo and performing a fresh clone.
You could also do:
git fetch origin --all
git switch main
git reset --hard origin/main
Where you substitute origin
with the name of your remote and main
with whatever branch you want to reset to it's current equivalent on the remote.