'How to remove commits after a certain date from local branch?
I'm trying to test something that requires me to remove all commits after 02/14/2022. I found the commit hash xyz
of the last commit on 02/13/2022, and did a
git reset --hard xyz
but got the error
fatal: failed to unpack tree object d41dc
error: Submodule 'third_party/eigen' could not be updated.
error: Submodule 'third_party/eigen' cannot checkout new HEAD.
fatal: Could not reset index file to revision 'xyz'.
I'm not sure what the d41dc
here is. Also tried git checkout xyz
and it gives the same error
Does anyone know how to fix this or have a better approach?
Solution 1:[1]
Since your current local repository seems damaged, try first to re-clone in a different folder the remote repository locally.
Then apply your git reset in the new local repository.
If it works, consider renaming the existing (possible corrupted) one, and replacing it with the new (now reset) cloned repository.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | VonC |