Remove a git commit which has not been pushed

前端 未结 11 738
抹茶落季
抹茶落季 2020-12-04 04:34

I did a git commit but I have not pushed it to the repository yet. So when I do git status, I get \'# Your branch is ahead of \'master\' by 1 commi

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 05:02

    Remove the last commit before push

    git reset --soft HEAD~1

    1 means the last commit, if you want to remove two last use 2, and so forth*

提交回复
热议问题