Xcode .gitignore对于xcuserdata文件夹中的所有内容不会忽略xcuserstate文件
我在一个Xcode项目中工作,我正在尝试配置.gitignore,使其不在xcuserdata文件夹中获取任何内容 我有以下几点意见:Xcode .gitignore对于xcuserdata文件夹中的所有内容不会忽略xcuserstate文件,xcode,git,gitignore,Xcode,Git,Gitignore,我在一个Xcode项目中工作,我正在尝试配置.gitignore,使其不在xcuserdata文件夹中获取任何内容 我有以下几点意见: # Xcode .DS_Store */build/* *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata profile *.moved-aside D
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
xcuserdata/*
xcuserdata/*
但每次我构建/运行项目并执行git status
,它仍然显示以下midified文件:
modified: MyProject.xcodeproj/project.xcworkspace/xcuserdata/fernando.xcuserdatad/UserInterfaceState.xcuserstate
有人知道怎么回事吗?我找到了解决办法
问题不在.gitignore文件中
问题在于未从git服务器中删除的UserInterfaceState.xUserState,在以下链接中找到了解决方案:
FWIW,git尚未跟踪我的XUserData文件夹,它仍显示在git状态下。问题是我在.gitignore文件中的
xuserdata
前面有一个空格。其他信息
我也遇到过这样的情况,从那以后似乎不起作用。gitignore在提交后仍然添加它们。我所添加的东西对我来说很有魅力
。。。。
无法被.gitignore读取:
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
xcuserdata/*
xcuserdata/*
添加以下内容对我很有用:
*xcworkspace/xcuserdata/*
或者说:
*/xcuserdata/*
对我来说,除了这个什么都不管用 将此行添加到您的gitignore
*.xcuserdata
如果使用git,可以添加.git忽略
*.xcuserdata
# Xcode
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.moved-aside
DerivedData
.idea/
*.xccheckout
*.moved-aside
xcuserdata/
*.hmap
*.ipa
*.xcworkspace
*.xcuserstate // <--- Here
!default.xcworkspace
#Xcode
*pbxuser先生
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.透视图3
!default.perspectivev3
*.移到一边
衍生数据
.想法/
*.xcheckout
*.移到一边
xcuserdata/
*.hmap
*.ipa
*.xcworkspace
*.xcuserstate/对我来说,除了这个,什么都不起作用,因为我想提交包含.xcuserdata的pod:
**/xcuserdata/*
你可以这么做
git checkout -- <file>..." to discard changes in working directory
这个问题来晚了,但这个网站帮我解决了这个问题:
具体使用标签swift
和xcode
生成以下内容:
我看不出有什么逻辑。
然而,在我的情况下,只有移动
xcuserdata/
到.gitignore文件的最底层。除了将*.xcuserstate
添加到.gitignore
文件之外,请记住删除缓存的*.xcuserstate
git rm--cached[YourProjectName].xcodeproj/project.xcworkspace/xcuserdata/[YourUsername].xcuserdatad/UserInterfaceState.xcuserstate
*xcworkspace/xcuserdata/*
为我工作!非常感谢。当然如果您以前提交了该文件,还应该将其从缓存中删除。这是否回答了您的问题?