* Fwd: Add git ignore as builtin
[not found] <CA+mQAOXPZSv2B8tVfC=4eJ7X_2j8Di4BkuE=z43=U2+VNpdQQg@mail.gmail.com>
@ 2014-11-15 11:22 ` Alberto Fanjul Alonso
2014-11-17 0:12 ` Ryan Jacobs
0 siblings, 1 reply; 5+ messages in thread
From: Alberto Fanjul Alonso @ 2014-11-15 11:22 UTC (permalink / raw)
To: git
After seeing -e option in git config (open config files in editor)
http://git-scm.com/docs/git-config
I decide it's time to propose to incorporate an alias really useful to me
git ignore
The repo is on https://github.com/albfan/git-ignore
basically:
git ignore <whatever> adds <whatever> to .git/info/exclude
and git ignore -e starts an editor to tweak your excludes
by default it operates con exclude file, but it can also work with
.gitignore using -i option
I find it invaluable for IDE project files, TODOs, test files...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Add git ignore as builtin
2014-11-15 11:22 ` Fwd: Add git ignore as builtin Alberto Fanjul Alonso
@ 2014-11-17 0:12 ` Ryan Jacobs
2014-11-17 20:59 ` Jeff King
0 siblings, 1 reply; 5+ messages in thread
From: Ryan Jacobs @ 2014-11-17 0:12 UTC (permalink / raw)
To: git
Alberto Fanjul Alonso <albertofanjul <at> gmail.com> writes:
> git ignore <whatever> adds <whatever> to .git/info/exclude
This should be "git exclude" not "git ignore".
Difference between the two: http://stackoverflow.com/questions/10066749/git-
excludes-vs-ignores
I'd second the notion of a "git ignore", however it would have to modify the
`.gitignore` not `.git/info/exclude`.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Add git ignore as builtin
2014-11-17 0:12 ` Ryan Jacobs
@ 2014-11-17 20:59 ` Jeff King
2014-11-17 21:38 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2014-11-17 20:59 UTC (permalink / raw)
To: Ryan Jacobs; +Cc: git
On Mon, Nov 17, 2014 at 12:12:25AM +0000, Ryan Jacobs wrote:
> Alberto Fanjul Alonso <albertofanjul <at> gmail.com> writes:
>
>
> > git ignore <whatever> adds <whatever> to .git/info/exclude
>
> This should be "git exclude" not "git ignore".
> Difference between the two: http://stackoverflow.com/questions/10066749/git-
> excludes-vs-ignores
I am not sure that the name difference is all that meaningful. Yes, we
call the repo-wide file .git/info/exclude and the in-tree ones
.gitignore, but I do not know if the distinction is more than historical
accident.
> I'd second the notion of a "git ignore", however it would have to modify the
> `.gitignore` not `.git/info/exclude`.
And I think this is a good reason why we do not have a "git ignore" tool
to write such things. If I say "git ignore foo" should it go into
.git/info/exclude or .gitignore? If the latter, should it be "foo" to
match everywhere, or "/foo" to match only the single path at the root?
If the file is "subdir/foo", should it go as "/subdir/foo" into the
top-level ".gitignore", or as "foo" into "subdir/.gitignore"? If you
ignore "foo.o" and "bar.o", should we suggest that you ignore "*.o"
instead?
Trying to accomodate all of those possibilities in a command-line tool
is hard, and probably counter-productive. We already have a simple
domain-specific language for specifying .gitignore files. You can just
try to cover a common case, like "always put the full slash-prefixed
path into the top-level .gitignore". But then I wonder if "git ignore"
is really adding much value, as it is just a thin wrapper around "echo".
-Peff
PS The more interesting case to automate (to me, anyway) is _checking_
paths against the hand-written .gitignore rules, which is complicated
to do by hand. You can do that already with "git check-ignore".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Add git ignore as builtin
2014-11-17 20:59 ` Jeff King
@ 2014-11-17 21:38 ` Junio C Hamano
2014-11-23 19:25 ` Javier Domingo Cansino
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2014-11-17 21:38 UTC (permalink / raw)
To: Jeff King; +Cc: Ryan Jacobs, git
Jeff King <peff@peff.net> writes:
> On Mon, Nov 17, 2014 at 12:12:25AM +0000, Ryan Jacobs wrote:
>
>> Alberto Fanjul Alonso <albertofanjul <at> gmail.com> writes:
>>
>>
>> > git ignore <whatever> adds <whatever> to .git/info/exclude
>>
>> This should be "git exclude" not "git ignore".
>> Difference between the two: http://stackoverflow.com/questions/10066749/git-
>> excludes-vs-ignores
>
> I am not sure that the name difference is all that meaningful. Yes, we
> call the repo-wide file .git/info/exclude and the in-tree ones
> .gitignore, but I do not know if the distinction is more than historical
> accident.
It is merely a historical accident.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: Add git ignore as builtin
2014-11-17 21:38 ` Junio C Hamano
@ 2014-11-23 19:25 ` Javier Domingo Cansino
0 siblings, 0 replies; 5+ messages in thread
From: Javier Domingo Cansino @ 2014-11-23 19:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, Ryan Jacobs, git@vger.kernel.org
I would love to have such tool included in the toolchain, but being
able to use it to edit all the ignore chain, defaulting to .gitignore.
Explain the reason in my case.
Usually, when ignoring stuff, you will probable ignore already your
IDE/Editor files using a global gitignore. And most of the times in a
per-project basis, you will be ignoring their output files. I only use
.git/info/exclude when I have something really special that I don't
want to share publicly, such as a data/ folder to run the project or
so.
That way, most of the times I will be modifying .gitignore, sometimes
my global gitignore and very occasionally, .git/info/exclude.
That's my case, and that I know of, people have that usage order,
.gitignore > global gitignore > local gitignore.
For sake of uniformity, I would use the same context specifiers as in
git-config. Defaulting to --repo for .gitignore, using --local for the
.git/info/exclue, using --global for the global gitignore, and
--system for the system one.
Also, about adding and excluding, I would recommend using verbs
instead of arguments, which would be in consonance with git remote.
git ignore exclude ....
git ignore include ....
You could also make it "smart" by allowing to use it as the Cisco
managing commands, or the ip tool (ip a == ip address, ip a a == ip
addr add, etc.), resulting in the following:
git ignore e ....
git ignore i ....
--
Javier Domingo Cansino
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-23 19:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CA+mQAOXPZSv2B8tVfC=4eJ7X_2j8Di4BkuE=z43=U2+VNpdQQg@mail.gmail.com>
2014-11-15 11:22 ` Fwd: Add git ignore as builtin Alberto Fanjul Alonso
2014-11-17 0:12 ` Ryan Jacobs
2014-11-17 20:59 ` Jeff King
2014-11-17 21:38 ` Junio C Hamano
2014-11-23 19:25 ` Javier Domingo Cansino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).