当我试图更新(拉入)我的本地git存储库的更改时,我得到的错误是有未跟踪的文件:
> git pull origin
Updating 556678a..e6eb9b0
error: The following untracked working tree files would be overwritten by merge:
templates/Sammel RKA Süddeutsche EM MU15 am 17.10.2015.doc
Please move or remove them before you can merge.
Aborting我可以使用git status来确认这一点
> git status
On branch feature/KRAS-6
Your branch is behind 'origin/feature/KRAS-6' by 16 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Untracked files:
(use "git add <file>..." to include in what will be committed)
"templates/Sammel RKA Su\314\210ddeutsche EM MU15 am 17.10.2015.doc"
nothing added to commit but untracked files present (use "git add" to track)然后我使用git clean来创建一个干净的工作目录:
> git clean -f -n
Would remove "templates/Sammel RKA Su\314\210ddeutsche EM MU15 am 17.10.2015.doc"
> git clean -f
Removing "templates/Sammel RKA Su\314\210ddeutsche EM MU15 am 17.10.2015.doc"现在看一下git status,它显示该文件已被删除(但这意味着它以前被跟踪过?):
> git status
On branch feature/KRAS-6
Your branch is behind 'origin/feature/KRAS-6' by 16 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
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: "templates/Sammel RKA S\303\274ddeutsche EM MU15 am 17.10.2015.doc"
no changes added to commit (use "git add" and/or "git commit -a"你知道怎么清理这个烂摊子吗?是否与文件名中的空格或特殊字符有关?
发布于 2016-05-10 17:40:44
好像是ü出了点问题。
也许可以尝试执行git checkout .,这将恢复您对跟踪的文件所做的所有更改,从而恢复它认为存在的删除。
我希望它不会再次显示为未跟踪。会很奇怪。
https://stackoverflow.com/questions/37134334
复制相似问题