git - .gitignore in xcode not taking effect -
my github project has structure:
foldera: unrelated stufffolderb->myproject-> xcode related files including.xcodeproj
in myproject i've downloaded .gitignore: https://github.com/github/gitignore/blob/master/swift.gitignore
this .gitgnore has line says xcuserdata. when seeing pending changes in git, still see files inside myproject.xcodeproj/project.xcworkspace/xcuserdata/.
my github repository empty, did not add file before trying add gitgnore.
to ignore directories name must add following .gitignore:
xuserdata/ 
with trailing / is. git manual:
if pattern ends slash, removed purpose of following description, find match directory. in other words, foo/ match directory foo , paths underneath it, not match regular file or symbolic link foo (this consistent way how pathspec works in general in git).
if add line xuserdata ignore file/directory named on path relative .gitignore won't find directory mentioned: 
if pattern not contain slash /, git treats shell glob pattern , checks match against pathname relative location of .gitignore file (relative toplevel of work tree if not .gitignore file).
please let me know if helped.
Comments
Post a Comment