Skip to main content

Command Palette

Search for a command to run...

Deleting a commit with Git

💡 If you want to delete a commit you can do an interactive rebase.

Updated
1 min read
Deleting a commit with Git
C

Hi, I'm Cristina Ramirez, I'm a computer engineer and software developer with more than 10 years of experience as backend developer, web application development, API REST services for mobile applications, system analysis and logic.

Programming languages: Ruby, PHP, C, C++, C#, CSS, JavaScript.

Frameworks: Ruby on Rails, PHP (Codeigniter, APPHP).

Experience of relational databases (Postgres, MySql, Oracle) and NoSQL databases (MongoDB, Neo4j).

I like innovation and teamwork.

🇻🇪 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

69 views