.gitignore delete all folders but one

Asked

Viewed 2,487 times

6

I need to make that one .gitignore delete from versioning all folders except one.

Example:

Library/nao_ignorar
Library/ignorar
Library/ignorar
Library/ignorar
....

2 answers

8


Thus:

# Ignore tudo:
*

# Exceto este diretório:

!Library/nao_ignorar Library/

The rest will be ignored. If you need to not ignore more directories below this directory, you need to specify the other directories, for example:

# Ignore tudo:
*

# Exceto estes diretórios:

!Library/nao_ignorar Library/
!Library/nao_ignorar Library/*/
!Library/nao_ignorar Library/*/OutroDiretorioNaoIgnorado/
!Library/nao_ignorar Library/*/OutroDiretorioNaoIgnorado/*/*

1

Hello try the following I yours . gitignore

# Ignorar todos os diretórios e arquivos em um diretório.
tmp/**/* 

I believe it solves.

  • Directories differentiate from language to language when ignoring?

  • improved boss?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.