Home > front end >  Delete commit in git
Delete commit in git

Time:09-20

I want to remove a commit from my repository, but using reset, reset --hard, and reset --soft removes all commits after the commit I specified and i want to keep those commits.

This is an example commit list: original

And i want this result: result

But i get this: fail

How can i get the result i want? Thank you

CodePudding user response:

git reset HEAD^ --hard
git push origin -f

I've used it before and it's work for me.

CodePudding user response:

Thank you all for your answers, I'll tell you what I used: there is a utility called rebase that allows us to make changes in our commit tree, the option squeeze merge several commits into one, the only drawback is that all the next commits are rewritten and their creation date is changed.

  •  Tags:  
  • git
  • Related