threads / discuss / 49968

Get "responsible" .gitignore file / rule

Subject: Get "responsible" .gitignore file / rule

## tl;dr

3 messages between Dec 7, 2018 and Dec 7, 2018.

replies: 2people: 2as markdown or json

Victor Toni· Dec 7, 2018, 12:35 UTC · lore

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· Dec 7, 2018, 12:44 UTC · re: Victor Toni · lore

Re: Get "responsible" .gitignore file / rule

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· Dec 7, 2018, 13:17 UTC · re: Eric Sunshine · lore

Re: Get "responsible" .gitignore file / rule

Am Fr., 7. Dez. 2018 um 13:45 Uhr schrieb Eric Sunshine <sunshine@sunshineco.com>:

Show 7 quoted lines
>
> 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)

← back to recent threads