Skip to content

Instantly share code, notes, and snippets.

@glueckpress
Last active January 4, 2023 17:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glueckpress/083857bd541cb9232f94c58d2fe4bacc to your computer and use it in GitHub Desktop.
Save glueckpress/083857bd541cb9232f94c58d2fe4bacc to your computer and use it in GitHub Desktop.
[git] Exclude .gitignore and all of WordPress, except specified directories
# Sample of .git/info/exclude
# Documentation: https://git-scm.com/docs/gitignore
# Exclude .gitignore file.
# If an initial .gitignore file has been added to the repo,
# you might have to delete it first and sync the change.
# Then create a new one which will be excluded according to this rule.
.gitignore
# Exclude all of WordPress, but keep these directories synced:
# /wp-content/mu-plugins
# /wp-content/themes/child-theme
# Exclude everything in root…
/*
# … except wp-content.
!/wp-content
# Now exclude everything in wp-content …
/wp-content/*
# … except mu-plugins …
!/wp-content/mu-plugins
# … and except themes.
!/wp-content/themes
# Now exclude everything in themes …
/wp-content/themes/*
# … except child theme.
!/wp-content/themes/child-theme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment