How to delete a only a specific commit in the middle of the git log

It shouldn’t be affected to above commits.

If you remove a commit from the middle of a branch, or really anywhere except possibly the HEAD of a branch, you will rewrite the history of that branch. This is because the tools you would use to effect this, namely git rebase --interactive and git filter-branch, would need to recommit everything which comes after the commit you removed. This is usually not desirable for a public shared branch because it forces everyone to take pretty draconian measures to keep up with that change.

Rather, a safer bet for you would be to use git revert:

git revert <SHA-1 of commit to delete>

This will add a new commit on the top of your branch which effectively undoes everything which the middle commit did.

By the way, if you really want to remove that commit, I would recommend doing an interactive rebase.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)