How to delete the last n commits on Github and locally?

后端 未结 3 1660
悲&欢浪女
悲&欢浪女 2020-12-04 05:45

I\'m trying to delete the last 2 commits from one of my GitHub repositories. I\'ve tried as suggested here : git push -f origin HEAD^^:master. It seems that it

3条回答
  •  旧巷少年郎
    2020-12-04 06:00

    To remove the last two commits locally I'd suggest using:

    git reset --hard HEAD^^
    

    Rebase is a completely different operation that won't help you here.

提交回复
热议问题