efpies
efpies

Reputation: 3725

Can't unignore certain file in ignored directory

I have .gitignore like this

**/my-site/components/*

So I ignore the /components folder completely. Okay, I just hacked a file inside of this folder, can I unignore it?

!**/my-site/components/com_content/models/articles.php

Hmm... that doesn't work. Let's try this.

!**/my-site/components/com_content/models/*

That doesn't work too. Curious. Maybe this one will work?

!**/my-site/components/com_content/*

Woo! 75 untracked files. Amazing. Am I an idiot or what is this? The most strange behavior I ever seen.

Now... what's happening here? I just want to unignore a single file into ignored folder.

Update

Yeah, I know, I can do something like this

!**/my-site/components/com_content/
**/my-site/components/com_content/*.*
**/my-site/components/com_content/controllers/*
**/my-site/components/com_content/helpers/*
**/my-site/components/com_content/models/*
!**/my-site/components/com_content/models/articles.php
**/my-site/components/com_content/views/*

but I'm looking for more elegant solution.

Upvotes: 0

Views: 326

Answers (1)

Dave S
Dave S

Reputation: 3468

Not ignore a file in a sub directory?

maybe something like this? been a while since i've used git but i think you should be able to get it from the link.

!**/my-site/components/
!**/my-site/components/com_content/
!**/my-site/components/com_content/models/
**/my-site/components/*
!articles.php

EDIT How about:

!**/my-site/components/
**/my-site/components/*
!com_content/models/articles.php

Upvotes: 2

Related Questions