您遇到了xxx和xxx/yyy.zz错误:构建树出现错误。

5
当我运行 git status 命令时,会出现如下内容:
$ git status
# On branch assets
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   index.html
#   new file:   sections
#   new file:   sections/asset/asset.ctrl.js
#   new file:   sections/asset/asset.tpl.html
#
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    sections

自从该项目启动以来,sections目录一直存在,所以不确定为什么它会认为这是一个新文件或需要被删除。当我尝试提交时,我收到以下信息:

You have both sections and sections/asset/asset.ctrl.js
error: Error building trees

有什么办法可以提交我的工作吗?
1个回答

8

我通过以下方式修复了这个错误:

git rm -r --cached sections          
git commit -m "blalblalba"       
git add .    
git commit -m "2blablalbla"

我不再有这个问题,所以无法确认这是否有效,但还是感谢您的回答。 - jkns.co
好的!谢谢伙计 :P - Francisco Javier Barrena

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接