Remove a git commit which has not been pushed

前端 未结 11 744
抹茶落季
抹茶落季 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 04:46

    I just had the same problem and ended up doing:

    git rebase -i HEAD~N
    

    (N is the number of commits git will show you)

    That prompts your text editor and then you can remove the commit you want by deleting the line associated with it.

提交回复
热议问题