{"thread":{"id":"31649","subject":"/* in .gitignore","startedAt":"2012-09-25T20:18:53Z","lastAt":"2012-09-26T00:03:22Z","messageCount":3,"participants":["Hilco Wijbenga","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"199907","messageId":"CAE1pOi1vEGVcg5wn9VjkSVmMO_hparmYP0hn86XwpSpMmB=Peg@mail.gmail.com","threadId":"31649","inReplyTo":null,"subject":"/* in .gitignore","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-09-25T20:18:53Z","receivedAt":"2012-09-25T20:18:53Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"Hi all,\n\nIf you add \"/*\" (or \"*\") to '.gitignore' Git will ignore '.gitignore'.\nThis means that your '.gitignore' appears to work (which in fact it\ndoes) but really it will only work for you because your '.gitignore'\nwill not be added to the repository. You have to override with an\nexplicit \"!/.gitignore\" for it to work correctly. (Or use \"git add -f\n.gitignore\".)\n\nNaturally, this behaviour makes perfect sense: \"/*\" means everything.\nStill, I was wondering whether it might be a good idea to make an\nexception for '.gitignore' itself? Then if somebody *really* wanted to\nignore '.gitignore' they could add \"/.gitignore\" to '.gitignore'?\n\nCheers,\nHilco\n"},{"id":"199914","messageId":"7vobktvgq8.fsf@alter.siamese.dyndns.org","threadId":"31649","inReplyTo":"CAE1pOi1vEGVcg5wn9VjkSVmMO_hparmYP0hn86XwpSpMmB=Peg@mail.gmail.com","subject":"Re: /* in .gitignore","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-25T23:13:19Z","receivedAt":"2012-09-25T23:13:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:\n\n> Naturally, this behaviour makes perfect sense: \"/*\" means everything.\n> Still, I was wondering whether it might be a good idea to make an\n> exception for '.gitignore' itself? Then if somebody *really* wanted to\n> ignore '.gitignore' they could add \"/.gitignore\" to '.gitignore'?\n\nIf somebody is sick enough to ignore \"everything\", he can add \"/*\"\nto the .gitignore file and in order to make sure he knows what he is\ndoing and he is doing what he thinks is doing, he would check with\n\"git diff --stat HEAD\" etc. before committing, and double check with\n\"git show --stat\" etc. after committing.\n\n\".gitignore\" (or \".gitattributes\" for that matter) shouldn't be any\ndifferent from your ordinary tracked contents.  If you have \"*.o\" in\nthe ignored pattern list, you would need an extra care to defeat the\npattern to add vendor-supplied binary-only object file with \"add -f\"\nand live with the fact that a new vendor-supplied binary-only object\nfile not appearing on untracked list.  It is exactly the same deal.\n\nHaving said that, I guess you could add \"!.git*\" to your\n$GIT_DIR/info/exclude and see if it gives an improved user\nexperience.\n"},{"id":"199918","messageId":"CAE1pOi2kU0dAqZVDwJAG9frG4Oq4rswtE85AL2Mk9eNCjRHhGg@mail.gmail.com","threadId":"31649","inReplyTo":"7vobktvgq8.fsf@alter.siamese.dyndns.org","subject":"Re: /* in .gitignore","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-09-26T00:03:22Z","receivedAt":"2012-09-26T00:03:22Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 25 September 2012 16:13, Junio C Hamano <gitster@pobox.com> wrote:\n> Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:\n>\n>> Naturally, this behaviour makes perfect sense: \"/*\" means everything.\n>> Still, I was wondering whether it might be a good idea to make an\n>> exception for '.gitignore' itself? Then if somebody *really* wanted to\n>> ignore '.gitignore' they could add \"/.gitignore\" to '.gitignore'?\n>\n> If somebody is sick enough to ignore \"everything\", he can add \"/*\"\n> to the .gitignore file and in order to make sure he knows what he is\n> doing and he is doing what he thinks is doing, he would check with\n> \"git diff --stat HEAD\" etc. before committing, and double check with\n> \"git show --stat\" etc. after committing.\n\nIgnoring everything is not quite so \"sick\". :-) My use case is\nEclipse's .metadata directory. This directory is *huge* but only\n.metadata/.plugins/org.eclipse.core.runtime/.settings/*.prefs is\nreally of interest (and not even all of those files). The subset of\n*.prefs that we are interested in will allow us to share Eclipse\nconfiguration settings (things like formatting settings and which\nwarnings we care about). So I have several '.gitignore' files with\n\"/*\" + \"!/some-dir/\". [To make things even more interesting, the\n\".settings\" directory should be ignored in all other places (so it's\nin our top level '.gitignore').]\n\nI would be very happy to find out better ways to handle this\nparticular scenario. I had quite a struggle getting it to work.\n\n> \".gitignore\" (or \".gitattributes\" for that matter) shouldn't be any\n> different from your ordinary tracked contents.  If you have \"*.o\" in\n> the ignored pattern list, you would need an extra care to defeat the\n> pattern to add vendor-supplied binary-only object file with \"add -f\"\n> and live with the fact that a new vendor-supplied binary-only object\n> file not appearing on untracked list.  It is exactly the same deal.\n\nI do not entirely agree. I think '.gitignore' *is* different. This\nfile is special and affects Git's behaviour. And it does so *before*\nit has been committed. Or even added. The fact that '.gitignore'\nitself is not listed in the output of, e.g., \"git status\" is easy to\nmiss.\n\nI have not really used '.gitattributes' but I assume the same applies.\n\n> Having said that, I guess you could add \"!.git*\" to your\n> $GIT_DIR/info/exclude and see if it gives an improved user\n> experience.\n\nMmm, that does not seem to help. I did\n\ngit init && touch file.txt && echo '/*'>.gitignore && echo\n'!.gitignore' >>.git/info/exclude && git status\n\nit lists nothing (Git 1.7.12). I had expected to see '.gitignore'. Did\nI misunderstand you?\n\nEven so, this would only improve *my* user experience, wouldn't it?\nThis would not get pushed to the central repository so it would not\nhelp anyone else.\n"}]}