Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in DevOps and Agile by (19.4k points)

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?

1 Answer

0 votes
by (27.5k points)

Git is probably already tracking the file.

In order to stop tracking a file that is currently tracked, use git rm --cached.

Use the following chunk of code but don't forget to replace [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"

Alternative way: You can also use the -a option to git commit that will add all files that have been modified or deleted.

Once you have removed the file from git, it will respect your .gitignore.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...