Deleting a commit with Git

๐Ÿ’ก If you want to delete a commit you can do an interactive rebase.

ยท

1 min read

๐Ÿ‡ป๐Ÿ‡ช Spanish

1.- You can do an interactive rebase with git rebase -i HEAD~ command. In HEAD~ you should indicate the numbers of the backward commit that you want to see.

git rebase -i HEAD~3

2.- Change pick by drop in the commit that you want to delete. For exit press ESC + Shift + : and write :wq to save changes.

drop 5cf29c5 Update README file with descripcions

3.- Use git log command to see historical changes.

git log

4.- Force push with the command:

git push origin main -f

Reference:

git-scm.com/book/es/v2

ย