Configure .gitignore to not track certain files within a directory

0

I am trying to configure the .gitignore file within my repository to track only certain files in a directory. So far what I have is this, but it does not work as I wish:

node_modules/*
node_modules/@themingisprose/icon-pack/*
!node_modules/@themingisprose/icon-pack/variables.scss
!node_modules/@themingisprose/icon-pack/style.scss
!node_modules/@themingisprose/icon-pack/svg/
!node_modules/@themingisprose/icon-pack/fonts/
!/node_modules/bootstrap/

In this case, I just want to follow the modifications of the files whose patterns start with ! , but if for example, within the directory icon-pack/ I modify the README.md git sees it as modified.

I have searched in different forums and the solutions are more or less what I have, but it does not work for me.

Thanks in advance.

    
asked by Roger TM 07.09.2018 в 20:54
source

1 answer

1

What happens is that you have added these files and now you want to ignore them, then what you should do is:

git rm "nombre del archivo"

that will eliminate it and now you must add it to your gitignore

 */directorio/*

that will make it not include any file within that directory

you can also use:

git update-index --assume-unchanged <file>

to not follow up on these files

    
answered by 07.09.2018 в 21:18