【发布时间】:2016-05-10 09:25:22
【问题描述】:
当尝试更新(拉取)对我的本地 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"
知道如何清理这个烂摊子吗?是否与文件名中的空格或特殊字符有关?
【问题讨论】:
标签: git