git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* why no "ignore" command on git
@ 2009-10-14 22:35 Ralf Thielow
  2009-10-14 23:02 ` Scott Wiersdorf
  2009-10-15  4:20 ` Wesley J. Landaker
  0 siblings, 2 replies; 6+ messages in thread
From: Ralf Thielow @ 2009-10-14 22:35 UTC (permalink / raw)
  To: git

Hello,

why does git don't have an "ignore" command, to ignore some files or
directories all the time.
In many project file structures you have IDE specified project files
or directories which
should not be tracked on git. All the time git says that you can add
these files, this is not
usable if you want to add many files with the "git add ." command.
I read on some pages by a google search that you can create
a ".gitignore" directory or something like that. But you had to do
this manually.

why there is no "ignore" command on git?

best regards

Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why no "ignore" command on git
  2009-10-14 22:35 why no "ignore" command on git Ralf Thielow
@ 2009-10-14 23:02 ` Scott Wiersdorf
  2009-10-15  4:20 ` Wesley J. Landaker
  1 sibling, 0 replies; 6+ messages in thread
From: Scott Wiersdorf @ 2009-10-14 23:02 UTC (permalink / raw)
  To: git

git does have a command to ignore files and directories: it's called
'emacs' (or 'vim' on some systems).

Seriously, the .gitignore file can contain a complex set of patterns
to ignore, and you can have .gitignore files at lower directories in a
hierarchy to override higher ones. This isn't something easily
contained in a simple command.

Scott


On Thu, Oct 15, 2009 at 12:35:23AM +0200, Ralf Thielow wrote:
> Hello,
> 
> why does git don't have an "ignore" command, to ignore some files or
> directories all the time.
> In many project file structures you have IDE specified project files
> or directories which
> should not be tracked on git. All the time git says that you can add
> these files, this is not
> usable if you want to add many files with the "git add ." command.
> I read on some pages by a google search that you can create
> a ".gitignore" directory or something like that. But you had to do
> this manually.
> 
> why there is no "ignore" command on git?
> 
> best regards
> 
> Ralf
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Scott Wiersdorf
<scott@perlcode.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why no "ignore" command on git
  2009-10-14 22:35 why no "ignore" command on git Ralf Thielow
  2009-10-14 23:02 ` Scott Wiersdorf
@ 2009-10-15  4:20 ` Wesley J. Landaker
  2009-10-15  9:29   ` Johannes Schindelin
  2009-10-15 11:31   ` Matthieu Moy
  1 sibling, 2 replies; 6+ messages in thread
From: Wesley J. Landaker @ 2009-10-15  4:20 UTC (permalink / raw)
  To: Ralf Thielow; +Cc: git

On Wednesday 14 October 2009 16:35:23 Ralf Thielow wrote:
> why does git don't have an "ignore" command, to ignore some files or
> directories all the time.
[...]
> I read on some pages by a google search that you can create
> a ".gitignore" directory or something like that. But you had to do
> this manually.
>
> why there is no "ignore" command on git?

You could always make your own git-ignore script, e.g.:

#!/bin/sh
echo "$@" >> .gitignore

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why no "ignore" command on git
  2009-10-15  4:20 ` Wesley J. Landaker
@ 2009-10-15  9:29   ` Johannes Schindelin
  2009-10-15 11:31   ` Matthieu Moy
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2009-10-15  9:29 UTC (permalink / raw)
  To: Wesley J. Landaker; +Cc: Ralf Thielow, git

Hi,

On Wed, 14 Oct 2009, Wesley J. Landaker wrote:

> On Wednesday 14 October 2009 16:35:23 Ralf Thielow wrote:
> > why does git don't have an "ignore" command, to ignore some files or
> > directories all the time.
> [...]
> > I read on some pages by a google search that you can create
> > a ".gitignore" directory or something like that. But you had to do
> > this manually.
> >
> > why there is no "ignore" command on git?
> 
> You could always make your own git-ignore script, e.g.:
> 
> #!/bin/sh
> echo "$@" >> .gitignore

Probably it needs to be a little more sophisticated, because of Postel's 
law.

#!/bin/sh

git rev-parse > /dev/null || exit
for f
do
	case "$f" in
	*'[*?]'*)
		# patterns probably are meant to be recursive
		echo "$f"
		;;
	*)
		echo /"$f"
		;;
	esac >> .gitignore
done
git add .gitignore


Ciao,
Dscho

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why no "ignore" command on git
  2009-10-15  4:20 ` Wesley J. Landaker
  2009-10-15  9:29   ` Johannes Schindelin
@ 2009-10-15 11:31   ` Matthieu Moy
  2009-10-15 15:52     ` Jeff King
  1 sibling, 1 reply; 6+ messages in thread
From: Matthieu Moy @ 2009-10-15 11:31 UTC (permalink / raw)
  To: Wesley J. Landaker; +Cc: Ralf Thielow, git

"Wesley J. Landaker" <wjl@icecavern.net> writes:

> On Wednesday 14 October 2009 16:35:23 Ralf Thielow wrote:
>> why does git don't have an "ignore" command, to ignore some files or
>> directories all the time.
> [...]
>> I read on some pages by a google search that you can create
>> a ".gitignore" directory or something like that. But you had to do
>> this manually.
>>
>> why there is no "ignore" command on git?
>
> You could always make your own git-ignore script, e.g.:
>
> #!/bin/sh
> echo "$@" >> .gitignore

Sure. OTOH, there are other interesting things a "ignore" command can
do. bzr, for example, has a "bzr ignore" command that can either add
stuff to your .bzrignore, or tell you which pattern cause which file
to be ignored. That's handy sometimes.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why no "ignore" command on git
  2009-10-15 11:31   ` Matthieu Moy
@ 2009-10-15 15:52     ` Jeff King
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff King @ 2009-10-15 15:52 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Wesley J. Landaker, Ralf Thielow, git

On Thu, Oct 15, 2009 at 01:31:01PM +0200, Matthieu Moy wrote:

> >> why there is no "ignore" command on git?
> >
> > You could always make your own git-ignore script, e.g.:
> >
> > #!/bin/sh
> > echo "$@" >> .gitignore
> 
> Sure. OTOH, there are other interesting things a "ignore" command can
> do. bzr, for example, has a "bzr ignore" command that can either add
> stuff to your .bzrignore, or tell you which pattern cause which file
> to be ignored. That's handy sometimes.

I wrote a toy patch that did something like that a while ago:

  http://thread.gmane.org/gmane.comp.version-control.git/108671/focus=108842

I don't think there is any reason such a thing could not be included
with git (if it did something more interesting than just echoing its
arguments to .gitignore), but nobody has felt strongly enough about it
yet to actually write something polished.

-Peff

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-15 15:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-14 22:35 why no "ignore" command on git Ralf Thielow
2009-10-14 23:02 ` Scott Wiersdorf
2009-10-15  4:20 ` Wesley J. Landaker
2009-10-15  9:29   ` Johannes Schindelin
2009-10-15 11:31   ` Matthieu Moy
2009-10-15 15:52     ` Jeff King

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).