when I use git to control my team project,this file always changed:
MyProject.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
How can I ignore this file?
when I use git to control my team project,this file always changed:
MyProject.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
How can I ignore this file?
When ignoring files with git, you use the .gitignore
file in the root of the repository.
Here is a sample that I use with all of my iOS development project at work and personal:
# Xcode
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
DerivedData
*.hmap
*.ipa
.idea/
# Pods - for those of you who use CocoaPods
Pods
xcuserdata/*
Keep note that just adding it to the gitignore will do little of anything. You also need to remove the file(s) from tracking.
You can do this with: git rm --cached xcuserdata/*
which will remove it from being tracked, but leave it on the file system.
For more information on gitignore and how it works, I recommend reading the scm documentation on it at http://git-scm.com/docs/gitignore
To ignore the files which we mentioned in the .gitignore file, we have to execute the following commands.
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
Please refer this question once.