Can't ignore UserInterfaceState.xcuserstate

Viewed 131745

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?

14 Answers

Here are some demo & short cuts if you uses GitHub, the basic ideas are the same.

1. Open terminal like this

enter image description here

2. Paste the below command to terminal followed by a space and then paste the path of the .xcuserstate file simply like this

git rm --cached enter image description here

3. Make sure you have the correct git ignore and then commit the code :)

enter image description here

This works for me

  1. Open the folder which contains the project file project.xcworkspace from the terminal.

  2. Write this command: git rm --cached *xcuserstate

This will remove the file.

For me nothing worked, but this

add this line to your gitignore

*.xcuserdata

Here is one more simple solution if you are using the source tree app. here are the instructions

1.Right-click on the file which you want to add to the git ignore list and select stop tracking. enter image description here

  1. again right-click on the same file and you will notice ignore option is now enabled then click on ignore button.

enter image description here

  1. now you can reset or commit your changes for the same file it depends on whether your changes are important or not. changes in the future will not be tracked for the selected file.

You can also ignore files from Xcode preferences itself.

Generate gitignore file from https://www.toptal.com/developers/gitignore

Go to Xcode -> Preferences -> Source Control -> Git -> Add all ignore items in the list...Even though UI is not really useful & you have to add all items individually but adding ignore files here surely works.

enter image description here

enter image description here

enter image description here

I think it would be better to write like this.

git rm --cache *//UserInterfaceState.xcuserstate**

Related