lundi 16 août 2021

How to Delete commits from a branch in Git

In Git you don't have the straight command like to direct "delete a commit" but you can do like by deleting the concernig part of the local branch the commits are on.

Using Fork you should do two things (or in Git command you will find) :

  • first you "Reset HEAD to here" you place yourself where you want to be in remote branch after you will suppress the commits you don't want anymore,.then you choose "Hard Discard all local changes
  • secondly you can "delete the local branch with the commits you don't want anymore.
This is not really simple, you have to understand the "Git" way of doing things, but at the end this is the most powerful tool ;-)

Aucun commentaire:

Enregistrer un commentaire