Remove a git commit which has not been pushed

前端 未结 11 729
抹茶落季
抹茶落季 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:58

    I believe that one of those will fit your need

    1 - Undo commit and keep all files staged: git reset --soft HEAD~;

    2 - Undo commit and unstage all files: git reset HEAD~;

    3 - Undo the commit and completely remove all changes: git reset --hard HEAD~;

    here is were I found the answer

提交回复
热议问题