How to ignore folders / directories in GIT? Ex: .metadata, .recommenders

3

I have a project in .git where I believe it is necessary to skip some files. However, I put the command and the folder continues to appear in git status. I did this:

creating gitignore file

touch .gitignore

Including files / directories in .gitignore to be ignored

# ignora os arquivos com extensões 
.gitignore
# ignora quaisquer diretórios chamados "metadata"
.metadata/
.recommenders/

But when giving the git status the changes that should not appear continue to appear, as the .gitignore has disappeared from the git status but the folder keeps appearing.

    
asked by anonymous 14.05.2017 / 00:13

2 answers

4

Only using the same gitignore. Note that if you have already added the files to the repository, you need to remove them.

git rm --cached -r /.metadata

Use the -r (recursive) argument when removing a folder and all files within it.

    
14.05.2017 / 06:27
3

Gitignore is just for this, create it in the root of your project with the name .gitignore and enter the code inside it.

# lembre de colocar o nome da pasta sem o ponto na frente
# Para ignorar todos arquivos e sub-pastas localizados na pasta metadata/plugins/
metadata/plugins/nome-do-plugin

# Para ignorar todos os arquivos e sub-pastas da pasta metadata/
metadata/

If you still have questions, check out this post that explains how to solve this problem .

    
14.05.2017 / 02:03