I want git to ignore my UserInterfaceState.xcuserstate
file in my XCode4 project, but where should I put the .gitignore
file?, is it inside the .
where should i put the
.gitignore
file?, is it inside the .git folder?
There is no .gitignore
inside a .git
folder.
The is however a .git/info/exclude
file, which allows you to exclude a file locally, generally when you want to exclude a file only for this specific repo (with an alias like this one):
git config alias.exclude "!sh -c 'echo \"$1\" >> .git/info/exclude' -"
git exclude UserInterfaceState.xcuserstate
If you need to exclude this file for all similar project, as Elnur Abdurrakhimov mentioned in his answer, exclude it globally.
echo UserInterfaceState.xcuserstate >> ~/.gitignore
But, as mentioned in "Do we need to check in *.xcuserstate?", if it is a type of file which should be ignored by any user of that repo, I would actually version a .gitignore at the top of the repo, with a content similar to:
*.xcuserstate
That way, any user of that repo won't even realize that this file exists and is generated (whatever its name is): it won't show up in a git status
ever.
Or you can ignore xcuserdata/ entirely (either in a global .gitignore
, or in a versioned one, like the generic GitHub Objective-C.gitignore file.