0

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?

Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95
fernando
  • 949
  • 1
  • 7
  • 13

3 Answers3

1

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

Justin
  • 2,131
  • 4
  • 24
  • 41
  • first thanks a lot. here i still have a question that when ignored this file, Will it effect the project on git or not?Also, will it make a trouble to the project or to my colleague? – fernando Apr 28 '15 at 11:28
  • Creating that file, you want to commit it so that your colleague has it in his local version as well. He/She will then be able to do their changes as they feel like without screwing with the repository itself. I implemented this in our first project about 6 months into it with no issues. – Justin Apr 29 '15 at 01:01
1
  • After adding files to the .gitignore file, to ignore those files we have to execute some commands.
  • 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.

Community
  • 1
  • 1
Anjaneyulu Battula
  • 1,910
  • 16
  • 33
0

By adding it or the folder containing the file to .gitignore.

http://git-scm.com/docs/gitignore

iceraj
  • 359
  • 1
  • 5