git commit stopped working - Error building trees

后端 未结 11 1247
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-23 16:13

I can not commit a change:

$ git commit
error: invalid object 100644 13da9eeff5a9150cf2135aaed4d2e337f97b8114 for \'spec/routing/splits_routing_spec.rb\'
err         


        
11条回答
  •  被撕碎了的回忆
    2020-12-23 16:32

    In my case, it is the file in remote branch that is broken. I solved it by:

    1. remove the remote branches at all by $ git remote rm origin
    2. add the remote back again: $ git remote add origin
    3. fetch the remote again: $ git fetch origin
    4. reset-hard to the desired branch on origin (say, develop): $ git reset --hard origin/develop

    Then everything goes back to normal.

提交回复
热议问题