Skip to content

Instantly share code, notes, and snippets.

@ozknozsrt
Last active September 20, 2020 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozknozsrt/7273cda14f21e209d57ae6642649c864 to your computer and use it in GitHub Desktop.
Save ozknozsrt/7273cda14f21e209d57ae6642649c864 to your computer and use it in GitHub Desktop.
How To Github delete a commit

How To Github delete a commit

Source YouTube link

1- Clone the repo to your machine.

git clone your_repo_link

2- Find ID of the commit which comes just before the commit which you want to delete.

You can use the command git log -n 10 or git log --pretty=oneline for that.

3- Then use this command:

git rebase -i commit_id

Your text editor will open with a file that list all the commits which come after your selected commit_id and in front of each commit there is the word "pick"

4- Force-push to remote repo

git push -f origin master

5- Check github. It should be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment