Is there a way to delete a commit without deleting the project on github ?

  • one
    what kind of information? hide the commit itself but the changes should remain? - Vyacheslav Danshin
  • @papiroca i'm talking about the commit itself - faoxis

2 answers 2

Is there a way to delete a commit without deleting the project on github?

An absolutely exact answer in the form - no.

and the “correct” answer will be:

  1. delete this commit in your local copy of the repository .
  2. Send this change to shared storage on github by adding the -f ( --force ) option:

     $ git push -f 
  3. notify other users of this shared repository, so that they also delete this commit in their local copies (if they "managed" to receive it).
  4. Be prepared for the fact that:
    1. from the local repositories of other users of this shared repository, this commit, if it has already been received by them, will not go anywhere (without their active intervention).
    2. this commit will again appear in the shared storage history you have copied, if at least one of the other users of this shared storage “managed” to receive this commit, and without taking actions to remove it from its local storage, execute the push command.

    Here githab says how to do it

    https://help.github.com/articles/remove-sensitive-data/