Reputation: 138
Is it possible to completely erase commit history in Git, so that a commit cannot be seen, and restore the repository to the state it had at that point in time? If so, how can this be done, through the command line or otherwise?
Upvotes: 0
Views: 58
Reputation: 9476
You can roll back to a specific commit and delete all later commits as follows:
git reset --hard <HASH>
where <HASH>
is the commit you want to roll back to. Obviously use it with care!
If you then want to push it up to a remote that already has later commits you need to push with the --force
flag to delete the later commits.
Upvotes: 2