# Get "responsible" .gitignore file / rule

3 messages from 2018-12-07 to 2018-12-07. Participants: Victor Toni, Eric Sunshine.
Thread: https://gitlist.dev/t/49968

## Victor Toni, 2018-12-07 12:35

Subject: Get "responsible" .gitignore file / rule
Message-ID: <CAG0OSgeTqFYGqqOOBF0TbKpsWb70Bv_wQ6-b4Ke=LTg6Z0OUMg@mail.gmail.com>
URL: https://gitlist.dev/e/CAG0OSgeTqFYGqqOOBF0TbKpsWb70Bv_wQ6-b4Ke%3DLTg6Z0OUMg%40mail.gmail.com

```
In a rather complex setup with deep directory structure it happens
every now and then, that files get ignored when trying to add them.
As these files are _not_ shown in `git status` but in `git status
--ignored` so I guess the culprit is some misconfigured `.gitignore`.

Trying to ad the specific file gives a:
$ git add ignored/file/name
The following paths are ignored by one of your .gitignore files:
ignored/file/name
Use -f if you really want to add them.

Using -v doen't add any verbosity. I'm using git 2.19.1.windows.1 if
this matters

I'm wondering if there is any way to show which rules (ideally with
the .gitignore file they are coming from) are causing a specific file
to get ignored so I could easily fix the .gitignore file?

```

## Eric Sunshine, 2018-12-07 12:44

Subject: Re: Get "responsible" .gitignore file / rule
Message-ID: <CAPig+cRvJWhnm22Xyb9J1wz2sKLycRKbAg299QfTZu5Tq8F07g@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcRvJWhnm22Xyb9J1wz2sKLycRKbAg299QfTZu5Tq8F07g%40mail.gmail.com
In-Reply-To: <CAG0OSgeTqFYGqqOOBF0TbKpsWb70Bv_wQ6-b4Ke=LTg6Z0OUMg@mail.gmail.com>

```
On Fri, Dec 7, 2018 at 7:36 AM Victor Toni <victor.toni@gmail.com> wrote:
> I'm wondering if there is any way to show which rules (ideally with
> the .gitignore file they are coming from) are causing a specific file
> to get ignored so I could easily fix the .gitignore file?

Perhaps the "git check-ignore" command would help.

```

## Victor Toni, 2018-12-07 13:17

Subject: Re: Get "responsible" .gitignore file / rule
Message-ID: <CAG0OSgdSfxzB1L_hsu9kwHshwckhf+Ay9QiWTZt2d5mNT3ykKw@mail.gmail.com>
URL: https://gitlist.dev/e/CAG0OSgdSfxzB1L_hsu9kwHshwckhf%2BAy9QiWTZt2d5mNT3ykKw%40mail.gmail.com
In-Reply-To: <CAPig+cRvJWhnm22Xyb9J1wz2sKLycRKbAg299QfTZu5Tq8F07g@mail.gmail.com>

```
Am Fr., 7. Dez. 2018 um 13:45 Uhr schrieb Eric Sunshine
<sunshine@sunshineco.com>:
>
> On Fri, Dec 7, 2018 at 7:36 AM Victor Toni <victor.toni@gmail.com> wrote:
> > I'm wondering if there is any way to show which rules (ideally with
> > the .gitignore file they are coming from) are causing a specific file
> > to get ignored so I could easily fix the .gitignore file?
>
> Perhaps the "git check-ignore" command would help.

Thanks for the tip!
Works like a charm (had to use the --verbose option though, without,
it does not give much feedback)

```
