Superpanchi
Superpanchi

Reputation: 91

Exceptions in .gitignore do not exclude files in subfolders

When I run git status it seems that it's only tracking files that have been modified but not new files in subfolders.

This is pretty much my .gitignore:

# Ignore everything
*

# But this files that i want to track
!.config/
!.fonts/
!.bashrc
!.gitignore
!.profile
!.Xresources
!.vimrc
!.zshrc

!README.md

It is in my $HOME. If I create a new file in directories .fonts/ or .config/ it seems like git is ignoring them. But it does track files like .vimrc or .zshrc

I tried to open this repo with GitKraken and it works how I'm expecting. I only have this error when I run git status in command line

Upvotes: 1

Views: 121

Answers (1)

Mureinik
Mureinik

Reputation: 311188

You could prefix these patterns with two asterisks (**) to match these files in any directory:

!**/.config/
!**/.fonts/
!**/.bashrc
!**/.gitignore
!**/.profile
!**/.Xresources
!**/.vimrc
!**/.zshrc

!**/README.md

Upvotes: 1

Related Questions