.gitignore won't ignore the directory
I'm trying to ignore the xcuserdata folders that xcode 4 modifies and they keep come back despite being in my .gitignore file.
My .gitignore file as one line:
xcuserdata
Yet as soon as I change anything UI in xcode, I get this:
# modified: XXXXXXXX.xcodeproj/project.xcworkspace/xcuserdata/XXXX.xcuserdatad/UserInterfaceState.xcuserstate
I have done a...
git rm -r --cached XXXXXXXX.xcode开发者_StackOverflow中文版proj/project.xcworkspace/xcuserdata/XXXX.xcuserdatad/UserInterfaceState.xcuserstate
...and tried...
git rm -r --cached XXXXXXXX.xcodeproj/project.xcworkspace/xcuserdata
...followed by a commit. I have done this close to 10 times and it just won't go away and be ignored. It keeps coming back.
What am I doing wrong? There is clearly something I am not understanding. The file did get added to the repository when I first created it and now I'm trying to get rid of it.
I just want that file to become completely untracked like it had never been added to the repository.
After doing
git rm -r --cached XXXXXXXX.xcodeproj/project.xcworkspace/xcuserdata
check that git status
tells you that the files under that folder have been deleted. Then after your commit, ensure that git says there is nothing to commit.
The fact that you have done this "10 times" and it comes as modified shows that you are not doing it right and the folder ( actually the files within it) are still tracked.
Apart from that the content of the .gitignore
seems fine and I have even confirmed on my repo that it works.
If you can't push your commit just because UserInterfaceState.xcuserstate
has been modified, here's a quick fix:
- Open the Organizer, go to Repositories, copy your the commit's code (something like
f01a2147218d by username
) - Open the terminal, go to your project's folder, do
git reset --hard f01a2147218d
- Push the commit!
try using xcuserdata/ in your .gitignore
精彩评论