# Configurable .gitignore filename?

5 messages from 2013-03-04 to 2013-03-05. Participants: Jari Pennanen, Matthieu Moy, David Aguilar.
Thread: https://gitlist.dev/t/33064

## Jari Pennanen, 2013-03-04 11:58

Subject: Configurable .gitignore filename?
Message-ID: <CACoicv+Hq=d5fJ7PXYdyvOdWmc3-GbFrsAf2Ze7dnQTzjExXnw@mail.gmail.com>
URL: https://gitlist.dev/e/CACoicv%2BHq%3Dd5fJ7PXYdyvOdWmc3-GbFrsAf2Ze7dnQTzjExXnw%40mail.gmail.com

```
If project or directory belongs to more than one GIT_DIR then some of
the GIT_DIR's may need a different .gitignore files, it would be
useful if one could define it independently, e.g. in GIT_DIR/config:

[core]
ignorefilename = .gitalternateignore

Has anyone considered making the .gitignore filename configurable? It
could be in a config file or env variable, but either way it would be
handy to be configurable. I'm not familiar with git's structure, but
if ignoring is only used in git-add then I suppose I could make own
git-add script if this is not implemented in core git.

I intend to use GIT as a rsync replica (or Dropbox replica) cause it
suits it better than rsync, since GIT doesn't have to check all files
each time I sync (and GIT can contain versions / backups, works better
on Windows and has a simpler needs for the server), more about why I
need this: https://groups.google.com/forum/#!topic/git-users/E-Au9P0A6NA/discussion%5B1-25-false%5D

- Jari

```

## Matthieu Moy, 2013-03-04 13:53

Subject: Re: Configurable .gitignore filename?
Message-ID: <vpqzjyjp8y0.fsf@grenoble-inp.fr>
URL: https://gitlist.dev/e/vpqzjyjp8y0.fsf%40grenoble-inp.fr
In-Reply-To: <CACoicv+Hq=d5fJ7PXYdyvOdWmc3-GbFrsAf2Ze7dnQTzjExXnw@mail.gmail.com>

```
Jari Pennanen <jari.pennanen@gmail.com> writes:

> If project or directory belongs to more than one GIT_DIR then some of
> the GIT_DIR's may need a different .gitignore files, it would be
> useful if one could define it independently, e.g. in GIT_DIR/config:
>
> [core]
> ignorefilename = .gitalternateignore

There is already core.excludesfile, which does not replace the usual
.gitignore but comes in addition. The common use is a user-wide ignore
file, not a per-directory one.

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

```

## Jari Pennanen, 2013-03-04 15:47

Subject: Re: Configurable .gitignore filename?
Message-ID: <CACoicvKMWSjU6Lf-2PsCShzqGiX-=2xF9+W0EtrHUzWPU7-T_A@mail.gmail.com>
URL: https://gitlist.dev/e/CACoicvKMWSjU6Lf-2PsCShzqGiX-%3D2xF9%2BW0EtrHUzWPU7-T_A%40mail.gmail.com
In-Reply-To: <vpqzjyjp8y0.fsf@grenoble-inp.fr>

```
2013/3/4 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:
> There is already core.excludesfile, which does not replace the usual
> .gitignore but comes in addition. The common use is a user-wide ignore
> file, not a per-directory one.

I'm actually aware of that. Problem is the normal .gitignore files
must *not* be used in the second GIT_DIR at all, in my case it's for
syncing so I need to sync almost all files (including stuff inside
.gitignore), though I'd still like to retain some ignore files for
second GIT_DIR, e.g. like in rsync the .rsync-filter file.

```

## David Aguilar, 2013-03-05 09:59

Subject: Re: Configurable .gitignore filename?
Message-ID: <CAJDDKr55ayTpzXPG3j5czY=-W08L8QjhMmjqWdRpoWO=MpHdyg@mail.gmail.com>
URL: https://gitlist.dev/e/CAJDDKr55ayTpzXPG3j5czY%3D-W08L8QjhMmjqWdRpoWO%3DMpHdyg%40mail.gmail.com
In-Reply-To: <CACoicvKMWSjU6Lf-2PsCShzqGiX-=2xF9+W0EtrHUzWPU7-T_A@mail.gmail.com>

```
On Mon, Mar 4, 2013 at 7:47 AM, Jari Pennanen <jari.pennanen@gmail.com> wrote:
> 2013/3/4 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:
>> There is already core.excludesfile, which does not replace the usual
>> .gitignore but comes in addition. The common use is a user-wide ignore
>> file, not a per-directory one.
>
> I'm actually aware of that. Problem is the normal .gitignore files
> must *not* be used in the second GIT_DIR at all, in my case it's for
> syncing so I need to sync almost all files (including stuff inside
> .gitignore), though I'd still like to retain some ignore files for
> second GIT_DIR, e.g. like in rsync the .rsync-filter file.

How about .git/info/exclude in the 2nd GIT_DIR?  Would that help?
-- 
David

```

## Jari Pennanen, 2013-03-05 10:28

Subject: Re: Configurable .gitignore filename?
Message-ID: <CACoicvK77mepwk-n9ZQ7TtCnMZfqDVycg_CgH5zHE3u6=KxHog@mail.gmail.com>
URL: https://gitlist.dev/e/CACoicvK77mepwk-n9ZQ7TtCnMZfqDVycg_CgH5zHE3u6%3DKxHog%40mail.gmail.com
In-Reply-To: <CAJDDKr55ayTpzXPG3j5czY=-W08L8QjhMmjqWdRpoWO=MpHdyg@mail.gmail.com>

```
2013/3/5 David Aguilar <davvid@gmail.com>:
> On Mon, Mar 4, 2013 at 7:47 AM, Jari Pennanen <jari.pennanen@gmail.com> wrote:
>> I'm actually aware of that. Problem is the normal .gitignore files
>> must *not* be used in the second GIT_DIR at all, in my case it's for
>> syncing so I need to sync almost all files (including stuff inside
>> .gitignore), though I'd still like to retain some ignore files for
>> second GIT_DIR, e.g. like in rsync the .rsync-filter file.
>
> How about .git/info/exclude in the 2nd GIT_DIR?  Would that help?

The second GIT_DIR must not use the .gitignore files of the first
GIT_DIR, so it does not help.

Only way to skip the .gitignore files in git-add is to use "git add -f
." but that skips all excludes, including the .git/info/exclude. I
need to skip .gitignore files used by the other GIT_DIR and still have
some of ignore rules, IMO this is not possible at the moment.

```
