I have a messed git repository. How to clean it?
This question already has an answer here:
Force my local master to be origin/master
One Solution collect form web for “I have a messed git repository. How to clean it?”
You could simply reset your own branch to the one from origin
git fetch origin git reset --hard origin/aBranch
That would remove any local commit and local modification from the working tree, and reset everything to what is fetched from the upstream repo.
If “origin” and “upstream” differ, you would need to “git push –force” one to the other (make sure the other collaborators are aware of that push).