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
- git: Copy a version for playing around
- How to clone all remote branches in Git?
- GIT how do I know who or which users cloned the repo?
- Clone huge 16 GB Git repo with Eclipse Neon
- Git clone using public private keys
- how to merge cloned git repository with the original repository
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).