How to cancel a local git commit

前端 未结 6 2024
抹茶落季
抹茶落季 2021-01-29 17:20

My issue is I have changed a file eg: README, added a new line \'this for my testing line\' and saved the file, then I issued the following commands

 gi         


        
6条回答
  •  无人共我
    2021-01-29 17:46

    Just use git reset without the --hard flag:

    git reset HEAD~1
    

    PS: On Unix based systems you can use HEAD^ which is equal to HEAD~1. On Windows HEAD^ will not work because ^ signals a line continuation. So your command prompt will just ask you More?.

提交回复
热议问题