Our central git repository got in a weird state after a commit that involved a reseted local repository.
I’m not 100% sure exactly what was done in this commit, but after this commit, changes from other commits can get silently overriden with older versions when stuff is pushed from this reseted local repository (“silently” means that overwrites of other commits don’t appear in the change history).
My questions are:
(1) How do I diagnose what happened (preferably without access to the reseted local repo)?
(2) Should I not be able to find out what happened, what is the best course of action to get rid of this state?
For (2) I am thinking about (a) discard the problematic local repo and never use it again, (b) HARD reset the central repo before the problematic commit and replay the commits excluding the problematic commit, manually.
You could see all changes made by a commit using
git show <commit-id>. Not sure what do you mean by “overwrites of other commits don’t appear in the change history”, there is no such thing as a overwrite in git, there are commits only.So, you have identified a problematic commit? When just
git revertit.Or a branch was rewritten by force push (some commits are disappeared from history)? That’s worse, you should use
git fsck −−lost-founduntil it is garbage collected.Next time configure the central repo to forbid non-fastforwards by
receive.denyNonFastForwards=trueor at least enable reflogs bylogAllRefUpdates=true.