Delete Github commit history

后端 未结 4 1806
天涯浪人
天涯浪人 2021-01-30 03:39

Is there anyway for me to delete my github commit history? I don\'t want to lose all my commits, just the last 10 or so that were pushed to github. I can\'t seem to figure out h

4条回答
  •  时光取名叫无心
    2021-01-30 04:09

    If you want to do this, you can use HEAD~10

    git reset --hard HEAD~10
    
    git push -f origin master
    

    It is not recommended to do delete server commit history, especially: if you have a team of people working on this repo.

    If you have a team of people working on this, I would recommend to fall back by adding another commit that undo your code you don't want.

提交回复
热议问题