VladimirBeetroot
5/17/2017 - 9:04 AM

Git Unignore. How to ignore all files in a WordPress install, except for those in your-theme.

Git Unignore.

How to ignore all files in a WordPress install, except for those in your-theme.

# ignore all files and folders in repo root
/*

# exceptions:

!/.gitignore
!/wp-content
/wp-content/*
!/wp-content/themes
/wp-content/themes/*
!/wp-content/themes/_mangrove*
!/wp-content/plugins
/wp-content/plugins/*
!/wp-content/plugins/mangrove*


# always ignore node_modules folders
**/node_modules

# always ignore these files
.DS_Store
Thumbs.db
.htaccess
sftp-config.json
Thumbs.db
.DS_Store
.svn
.cvs

# always ignore files with these extensions
*.sql
*.bak
*.swp



# large/disallowed file types
# a CDN should be used for these
*.hqx
*.bin
*.exe
*.dll
*.deb
*.dmg
*.iso
*.img
*.msi
*.msp
*.msm
*.mid
*.midi
*.kar
*.mp3
*.ogg
*.m4a
*.ra
*.3gpp
*.3gp
*.mp4
*.mpeg
*.mpg
*.mov
*.webm
*.flv
*.m4v
*.mng
*.asx
*.asf
*.wmv
*.avi
/*                              # ignore all files and folders in the repo directory

!/wp-content                    # unignore /wp-content directory
/wp-content/*                   # ignore all files/folders in /wp-content

!/wp-content/themes             # unignore themes directory
/wp-content/themes/*            # ignore all themes
!/wp-content/themes/your-theme  # unignore your theme



**/node_modules   # always ignore the node_modules folder, wherever it is
sftp-config.json  # always ignore this file
*.sql             # always ignore files ending in .sql