I'm using Git for Xcode 4 project version control. I've explicitly added ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate
to .gitignore
, but Git it won't ignore it. Any ideas why this is so?
In SourceTree, right click on the xcuserstate file and choose “Ignore…”. Select “Ignore exact filename” and for Add this ignore entry to, select “This repository only”. Delete the file from the repo also.
1, UserInterfaceState. xcuserstate's are binary-formatted plist files that can exist in either of project files or workspace files. They are user-specific and many can be present in a given Xcode project or workspace.
Files in xcuserdata are non-shared scheme data and UI configuration (e.g. UserInterfaceState. xcuserstate ). They are non-shared in that they belong to a user. Those settings are only read when you are the user.
Git is probably already tracking the file.
From the gitignore docs:
To stop tracking a file that is currently tracked, use git rm --cached.
Use this, replacing [project]
and [username]
with your info:
git rm --cached [project].xcodeproj/project.xcworkspace/xcuserdata/[username].xcuserdatad/UserInterfaceState.xcuserstate git commit -m "Removed file that shouldn't be tracked"
Alternatively you can use the -a
option to git commit
that will add all files that have been modified or deleted.
Once you've removed the file from git, it will respect your .gitignore
.
In case that the ignored file kept showing up in the untracked list, you may use git clean -f -d
to clear things up.
1.
git rm --cached {YourProjectFolderName}.xcodeproj/project.xcworkspace/xcuserdata/{yourUserName}.xcuserdatad/UserInterfaceState.xcuserstate
2.
git commit -m "Removed file that shouldn't be tracked"
3. WARNING first try git clean -f -d --dry-run
, otherwise you may lose uncommited changes.
Then: git clean -f -d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With