我今天打了这个:
% git checkout another_branch
error: The following untracked working tree files would be overwritten by checkout:
__version__.txt
alembic.ini
alembic/README
alembic/env.py
alembic/script.py.mako
folder1/file1
folder2/file2
....
Please move or remove them before you can switch branches.
Aborting
好的,所以我将删除未跟踪的文件:
% git clean -f
Not removing alembic/
Not removing tools/maintenance/
但是,似乎并非所有未跟踪的文件都已删除:
% git checkout another_branch
error: The following untracked working tree files would be overwritten by checkout:
alembic/README
alembic/env.py
alembic/script.py.mako
Please move or remove them before you can switch branches.
Aborting
奇怪的是,起初git checkout another_branch
git 知道它后来抱怨的那些特定的未跟踪文件 ( alembic/README
, alembic/env.py
, alembic/script.py.mako
)。
那么为什么 git 没有删除它们呢?