git commit deleting all files in repo

后端 未结 1 1355
攒了一身酷
攒了一身酷 2021-02-09 22:47

For the second time today git commit -m \"don\'t quit me now\" deletes my entire repo. So it goes:

$ git add .
$ git commit -m \"please, be gentle\"         


        
相关标签:
1条回答
  • 2021-02-09 23:13

    Since git status tells you that everything is staged for deletion, before doing anything else, reset the index to HEAD:

    git reset HEAD
    

    After doing this, git status should echo

    no changes added to commit (use "git add" and/or "git commit -a")
    

    Then, try again:

    git add .
    git commit -m "new try"
    
    0 讨论(0)
提交回复
热议问题