On Tue, Jan 22, 2019 at 10:55:50AM -0800, cl.robitai...@gmail.com wrote: > Is there a way to list ALL of the ignore files that a given git uses?
Yes. This list is documented in the gitignore(5) manual page. Run `git help ignore` to read it. > There are tons of files and locations that git uses and Googling only > reports a partial list...... in my case, I had, but forgotten, both > ~/.gitconfig AND ~/.config/git/ignore. The later was never mentioned > anywhere on Google but was the culprit of my issue. Your general problem is a wrong approach: instead of googling, you should better have spent your time contemplating the first two paragraphs of the manual page mentioned above. > Ok, I know, git check-ignore be used. But not in my case!!! Here is an > example > > git add lib > The following paths are ignored by one of your .gitignore files: > lib > Use -f if you really want to add them. > > > git check-ignore lib > NO OUTPUT > > > git check-ignore -v -n lib > :: lib > > > The 2 git check-ignore clearly say that lib should not be ignored (the NO > OUTPUT is me writing) while git add ignores it. So, somehow, git > check-ignore is misleading. Some files under lib are already under control; > I probably added lib/ in the ignore long time ago (so that I forgot) and > MAY be the reason why git check-ignore fails reporting the same behaviour > as git add. Just a guess though... No, you just have a mental model about how `git check-ignore` works different from how it's actually implemented. Again, reading the manual page of that command should have helped. In the intro part of that manual page, we read: | By default, tracked files are not shown at all since they are not | subject to exclude rules; but see ‘--no-index’. So, the reason Git says you have 'lib' ignored when you attempt to `git add` it is because you have this directory ignored _and_ have it included in the commit HEAD points at (what you currently have checked out). To demonstrate: ~$ cd ~/tmp tmp$ mkdir zzz tmp$ cd zzz zzz$ git init . Initialized empty Git repository in /home/kostix/tmp/zzz/.git/ zzz$ touch aaa zzz$ git add aaa zzz$ git commit aaa [master (root-commit) f98e522] boo 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 aaa zzz$ mkdir lib zzz$ touch lib/bbb zzz$ git add lib/bbb zzz$ git commit [master 2a63dbe] trrr 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/bbb zzz$ echo 'lib/' >.gitignore zzz$ git add lib The following paths are ignored by one of your .gitignore files: lib Use -f if you really want to add them. zzz$ git check-ignore -v lib zzz$ git check-ignore -v -n lib :: lib So, that's precisely what you see. Now let's add "--no-index" as suggested by the manual page - to ignore "lib" even if we have it tracked: zzz$ git check-ignore -v --no-index lib .gitignore:1:lib/ lib It works. TL;DR 1) You have your "lib" directory tracked by Git. This means the currently checked out commit have at least a single file from that directory (or deeper) included. 2) You have your "lib" directory ignored. The crux here is that the "ignoring" mechanics have nothing to with what files Git actually tracks (as part of commits). The behaviour of the `git check-ignore` may arguably seem weird but it's documented nonetheless. Hope this helps. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.