How to delete latest github commit forever?

By | September 21, 2024

If you made a commit to a shared repo by accident and want to remove all traces, do a git reset –hard on the commit you want to reset to. The key is to FORCE push this to git.

Use this command wisely and sparingly though as it could play havoc with other team members. In fact, it’s safer to use only if you are the one who has access to a repo. For shared repos, you’ll want to use revert instead.

Category: Git

Leave a Reply

Your email address will not be published. Required fields are marked *