我在分支feature/branch1
,git status
列出文件中的两个.gitignore
文件。当我尝试结帐到develop
分支时,git 阻止我显示此消息:
error: Your local changes to the following files would be overwritten by checkout:
XXXXXXX.xcworkspace/xcuserdata/XXXX.xcuserdatad/UserInterfaceState.xcuserstate
Please, commit your changes or stash them before you can switch branches.
Aborting
然后我尝试添加这些文件,尽管它们在.gitignore
文件中列出,所以我收到了这条消息:
The following paths are ignored by one of your .gitignore files:
XXXXXXX.xcworkspace
Use -f if you really want to add them.
fatal: no files added
为什么 git 要求我添加这些文件?是不是因为它们在develop
分支中没有被忽略。处理这种情况的最佳选择是什么?提前谢谢。