{"thread":{"id":"37975","subject":"Fwd: Add git ignore as builtin","startedAt":"2014-11-15T11:22:05Z","lastAt":"2014-11-23T19:25:15Z","messageCount":5,"participants":["Alberto Fanjul Alonso","Ryan Jacobs","Jeff King","Junio C Hamano","Javier Domingo Cansino"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"251939","messageId":"CA+mQAOU_UnPuSk0f9d1sUnxBj8M4zEX7bwa4Dw_z_PJV3Lp4LA@mail.gmail.com","threadId":"37975","inReplyTo":"CA+mQAOXPZSv2B8tVfC=4eJ7X_2j8Di4BkuE=z43=U2+VNpdQQg@mail.gmail.com","subject":"Fwd: Add git ignore as builtin","fromName":"Alberto Fanjul Alonso","fromEmail":"albertofanjul@gmail.com","sentAt":"2014-11-15T11:22:05Z","receivedAt":"2014-11-15T11:22:05Z","isPatch":false,"sender":{"key":"albertofanjul@gmail.com","avatar":null},"body":"After seeing -e option in git config (open config files in editor)\n\nhttp://git-scm.com/docs/git-config\n\nI decide it's time to propose to incorporate an alias really useful to me\n\ngit ignore\n\nThe repo is on https://github.com/albfan/git-ignore\n\nbasically:\n\ngit ignore <whatever> adds <whatever> to .git/info/exclude\n\nand git ignore -e starts an editor to tweak your excludes\n\nby default it operates con exclude file, but it can also work with\n.gitignore using -i option\n\nI find it invaluable for IDE project files, TODOs, test files...\n"},{"id":"251971","messageId":"loom.20141117T010932-213@post.gmane.org","threadId":"37975","inReplyTo":"CA+mQAOU_UnPuSk0f9d1sUnxBj8M4zEX7bwa4Dw_z_PJV3Lp4LA@mail.gmail.com","subject":"Re: Fwd: Add git ignore as builtin","fromName":"Ryan Jacobs","fromEmail":"ryan.mjacobs@gmail.com","sentAt":"2014-11-17T00:12:25Z","receivedAt":"2014-11-17T00:12:25Z","isPatch":false,"sender":{"key":"ryan.mjacobs@gmail.com","avatar":null},"body":"Alberto Fanjul Alonso <albertofanjul <at> gmail.com> writes:\n\n\n> git ignore <whatever> adds <whatever> to .git/info/exclude\n\nThis should be \"git exclude\" not \"git ignore\".\nDifference between the two: http://stackoverflow.com/questions/10066749/git-\nexcludes-vs-ignores\n\nI'd second the notion of a \"git ignore\", however it would have to modify the \n`.gitignore` not `.git/info/exclude`.\n"},{"id":"252002","messageId":"20141117205957.GB15880@peff.net","threadId":"37975","inReplyTo":"loom.20141117T010932-213@post.gmane.org","subject":"Re: Fwd: Add git ignore as builtin","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-11-17T20:59:57Z","receivedAt":"2014-11-17T20:59:57Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 17, 2014 at 12:12:25AM +0000, Ryan Jacobs wrote:\n\n> Alberto Fanjul Alonso <albertofanjul <at> gmail.com> writes:\n> \n> \n> > git ignore <whatever> adds <whatever> to .git/info/exclude\n> \n> This should be \"git exclude\" not \"git ignore\".\n> Difference between the two: http://stackoverflow.com/questions/10066749/git-\n> excludes-vs-ignores\n\nI am not sure that the name difference is all that meaningful. Yes, we\ncall the repo-wide file .git/info/exclude and the in-tree ones\n.gitignore, but I do not know if the distinction is more than historical\naccident.\n\n> I'd second the notion of a \"git ignore\", however it would have to modify the \n> `.gitignore` not `.git/info/exclude`.\n\nAnd I think this is a good reason why we do not have a \"git ignore\" tool\nto write such things. If I say \"git ignore foo\" should it go into\n.git/info/exclude or .gitignore? If the latter, should it be \"foo\" to\nmatch everywhere, or \"/foo\" to match only the single path at the root?\nIf the file is \"subdir/foo\", should it go as \"/subdir/foo\" into the\ntop-level \".gitignore\", or as \"foo\" into \"subdir/.gitignore\"? If you\nignore \"foo.o\" and \"bar.o\", should we suggest that you ignore \"*.o\"\ninstead?\n\nTrying to accomodate all of those possibilities in a command-line tool\nis hard, and probably counter-productive. We already have a simple\ndomain-specific language for specifying .gitignore files.  You can just\ntry to cover a common case, like \"always put the full slash-prefixed\npath into the top-level .gitignore\". But then I wonder if \"git ignore\"\nis really adding much value, as it is just a thin wrapper around \"echo\".\n\n-Peff\n\nPS The more interesting case to automate (to me, anyway) is _checking_\n   paths against the hand-written .gitignore rules, which is complicated\n   to do by hand.  You can do that already with \"git check-ignore\".\n"},{"id":"252005","messageId":"xmqq8uj9y0ck.fsf@gitster.dls.corp.google.com","threadId":"37975","inReplyTo":"20141117205957.GB15880@peff.net","subject":"Re: Fwd: Add git ignore as builtin","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-11-17T21:38:03Z","receivedAt":"2014-11-17T21:38:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Nov 17, 2014 at 12:12:25AM +0000, Ryan Jacobs wrote:\n>\n>> Alberto Fanjul Alonso <albertofanjul <at> gmail.com> writes:\n>> \n>> \n>> > git ignore <whatever> adds <whatever> to .git/info/exclude\n>> \n>> This should be \"git exclude\" not \"git ignore\".\n>> Difference between the two: http://stackoverflow.com/questions/10066749/git-\n>> excludes-vs-ignores\n>\n> I am not sure that the name difference is all that meaningful. Yes, we\n> call the repo-wide file .git/info/exclude and the in-tree ones\n> .gitignore, but I do not know if the distinction is more than historical\n> accident.\n\nIt is merely a historical accident.\n"},{"id":"252404","messageId":"CALZVapm0VJ9JsT3Ur86F-vYFMoRtKgDiJ3PO_aYPRyNFgz6iEw@mail.gmail.com","threadId":"37975","inReplyTo":"xmqq8uj9y0ck.fsf@gitster.dls.corp.google.com","subject":"Re: Fwd: Add git ignore as builtin","fromName":"Javier Domingo Cansino","fromEmail":"javierdo1@gmail.com","sentAt":"2014-11-23T19:25:15Z","receivedAt":"2014-11-23T19:25:15Z","isPatch":false,"sender":{"key":"javierdo1@gmail.com","avatar":"https://gravatar.com/avatar/0f43d4d2e5f4320e8b5e1a46914213c5459dd0de261ab1587f222827f863d727?d=mp&s=160"},"body":"I would love to have such tool included in the toolchain, but being\nable to use it to edit all the ignore chain, defaulting to .gitignore.\nExplain the reason in my case.\n\nUsually, when ignoring stuff, you will probable ignore already your\nIDE/Editor files using a global gitignore. And most of the times in a\nper-project basis, you will be ignoring their output files. I only use\n.git/info/exclude when I have something really special that I don't\nwant to share publicly, such as a data/ folder to run the project or\nso.\n\nThat way, most of the times I will be modifying .gitignore, sometimes\nmy global gitignore and very occasionally, .git/info/exclude.\n\nThat's my case, and that I know of, people have that usage order,\n.gitignore > global gitignore > local gitignore.\n\nFor sake of uniformity, I would use the same context specifiers as in\ngit-config. Defaulting to --repo for .gitignore, using --local for the\n.git/info/exclue, using --global for the global gitignore, and\n--system for the system one.\n\nAlso, about adding and excluding, I would recommend using verbs\ninstead of arguments, which would be in consonance with git remote.\n\ngit ignore exclude ....\ngit ignore include ....\n\nYou could also make it \"smart\" by allowing to use it as the Cisco\nmanaging commands, or the ip tool (ip a == ip address, ip a a == ip\naddr add, etc.), resulting in the following:\ngit ignore e ....\ngit ignore i ....\n\n-- \nJavier Domingo Cansino\n"}]}