I want to use a .gitignore
file to ignore all folders beginning with a period (hidden folders of linux).
I can't figure out the syntax, though I'm sure it's simple.
How's it done?
Use one of these patterns:
# ignore all . files but include . folders
.*
!.*/
# ignore all . files and . folders
.*
# Dont ignore .gitignore (this file)
# This is just for verbosity, you can leave it out if
# .gitignore is already tracked or if you use -f to
# force-add it if you just created it
!/.gitignore
# ignore all . folders but include . files
.*/
What is this pattern?
.*
- This patter tells git to ignore all the files which starts with .
!
- This tells git not to ignore the pattern. In your case /.gitignore
A demo can be found in this answer:
Git: how to ignore hidden files / dot files / files with empty file names via .gitignore?