# Deleting a commit with Git

[`🇻🇪 Spanish`](https://crisprogramando.hashnode.dev/eliminar-un-commit-con-git)

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.

```javascript
git rebase -i HEAD~3
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678893846234/ce6eebf0-0656-4061-879a-8425cff334e9.png?auto=compress,format&format=webp align="left")

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

```javascript
drop 5cf29c5 Update README file with descripcions
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678893883452/31dbe5ad-6e28-4019-a6c4-8161aa7f9bc7.png?auto=compress,format&format=webp align="left")

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

```javascript
git log
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678893930733/68987316-f2f8-4165-a951-08ffbef9612d.png?auto=compress,format&format=webp align="left")

4.- Force `push` with the command:

```javascript
git push origin main -f
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678893968294/5367db21-f6f4-4f37-a5eb-e14857f42828.png?auto=compress,format&format=webp align="left")

### **Reference:**

[**git-scm.com/book/es/v2**](http://git-scm.com/book/es/v2)
