1

I have the following source tree:

main_folder
main_folder/data
main_folder/subfolder1
main_folder/subfolder1/data
main_folder/subfolder1/subfolder
main_folder/subfolder1/subfolder/data
................
................

What's the proper .gitignore syntax, to exclude the data subfolder, wherever it appears in the source tree?

EastsideDev
  • 6,257
  • 9
  • 59
  • 116
  • 1
    Possible duplicate of [.gitignore - ignore any 'bin' directory](http://stackoverflow.com/questions/1470572/gitignore-ignore-any-bin-directory) – Jelmergu May 17 '17 at 15:36

1 Answers1

3

in a .gitignore file you're able to ignore files in multiple different ways. You could exclude files by setting them piece for piece like the example below:

/main_folder/data
/main_folder/subfolder_1/data
...
...

But you're also able to select al the subfolders in a folder by using the asterix symbol like the example below:

/main_folder/*
/main_folder/subfolder_1/*

in your case you should use the following to exclude all folders with the name data. Example:

data/

A simulair question like yours you can find here

hope this helps!

Community
  • 1
  • 1
Deathstorm
  • 818
  • 11
  • 36