Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't ignore UserInterfaceState.xcuserstate

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?

like image 976
GarlicFries Avatar asked Jul 03 '11 17:07

GarlicFries


People also ask

How do you ignore Xcuserstate?

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.

What is UserInterfaceState Xcuserstate?

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.

What is Xcuserdatad?

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.


2 Answers

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.

like image 173
matt Avatar answered Oct 04 '22 17:10

matt


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

like image 43
Xing Avatar answered Oct 04 '22 17:10

Xing