Pergunta

I have one directory named "ignore-folder" and I track it in git, but I want to ignore the files and directories in it, how should I edit the .gitignore?

Foi útil?

Solução

Add a .gitignore to the directory that you want to be tracked, ignoring all files inside that dir.

Like so

# Ignore everything in this directory
*
# Except this file
!.gitignore

or if you want to be more specific, eg only csv files

*.csv

Also check ".gitignore exclude files in directory but not certain directories"

Outras dicas

if you want to track the folder itself, but not the files in the folder, you should edit the .gitignore to say yourdirectoryname/*

If you want to ignore the directory as well, you can write yourdirectoryname/ in the .gitignore

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top