git ignore all files and folders in folder

C++
# exclude everything
somefolder/*

# exception to the rule
!somefolder/.gitkeep *
*/
!.gitignore

Source

Also in C++: