My .gitignore
file contains these lines :
xcuserdata/**/*
!xcuserdata/**/xcschemes/*
But the following file is still tracked
/MyApp/MyApp.xcodeproj/xcuserdata/colas.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
Why is it so? How can I fix that?
PS: If I had MyApp.xcodeproj/xcuserdata/colas.xcuserdatad/xcdebugger
, the files are ignored. But I don't understand why it does not ignore them without this "hack".
Contrary to what is said in one of the answer, the pattern
xcuserdata/**/*
!xcuserdata/**/xcschemes/*
works !!! I mean, the files under /xcschemes
are tracked.
See also the post Git ignore file for Xcode projects, where I get this .gitignore
file.
My Git
version is 1.8.3.4 (Apple Git-47)
.
When I git check-ignore
this file, here is what I get
fatal: Not a git repository (or any of the parent directories): .git
But the fact is that a parent directory is a git directory...
When I git check-ignore --no-index --
this file, here is what I get
[MT] PluginLoading: Required plug-in compatibility UUID 37B30044-3B14-46BA-ABAA-F01000C27B63 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XcodeSnippetsHelper.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-02-10 10:03:50.856 xcodebuild[1496:d07] XcodeColors: load (v10.1)
2014-02-10 10:03:50.859 xcodebuild[1496:d07] XcodeColors: pluginDidLoad:
fatal: Not a git repository (or any of the parent directories): .git
From the root folder :
if I don't use the no-index
option, there is no reply to git check-ignore
.
if I use the no-index
option: I get the error error: unknown option 'no-index'
...
Strange ;-!
First, you can do a git check-ignore
(git 1.8.3.3+) to see what rule is ignoring your file (assuming it wasn't in the index in the first place)
Second, read ".gitignore
exclude folder but include specific subfolder":
It is not possible to re-include a file if a parent directory of that file is excluded. (
*
)
(*
: unless certain conditions are met in git 2.8+, see below)
Git doesn't list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.
So the file of xcschemes
wouldn't be un-ignored anyway.
You needed to ignore parent folder per parent folder.
But a better approach is to ignores files only, and then exclude the folder:
xcuserdata/**
!xcuserdata/**/
!xcuserdata/**/xcschemes/**
Remember:
You need to exclude folders from the gitignore
rules before being able to exclude files.
Note that with git 2.9.x/2.10 (mid 2016?), it might be possible to re-include a file if a parent directory of that file is excluded if there is no wildcard in the path re-included.
Nguyễn Thái Ngọc Duy (pclouds
) is trying to add this feature:
However:
The directory part in the re-include rules must be literal (i.e. no wildcards)
So that wouldn't have worked here anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With