Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What will be the most suitable settings in .gitignore file for Wordpress project? [closed]

Tags:

git

wordpress

When using git with Wordpress project, what will be recommended settings for .gitignore file?

like image 859
ivankoni Avatar asked Nov 28 '12 14:11

ivankoni


People also ask

What should be in my Gitignore file?

gitignore should list the names or name-patterns of files that will be found in work-trees when working with your project, but that should not be committed to the project. In other words, it's not OS-specific, it's project-specific.

What would you use a .gitignore file for?

If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a .gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.

What should I ignore in Gitignore?

gitignore file is a plain text file that contains a list of all the specified files and folders from the project that Git should ignore and not track. Inside . gitignore , you can tell Git to ignore only a single file or a single folder by mentioning the name or pattern of that specific file or folder.


1 Answers

Posting this as an answer because it seems I can't comment on answers.

I suggest the following (based on Dales answer):

.htaccess
wp-config.php
wp-content/*
!wp-content/themes/
!wp-content/plugins/
sitemap.xml
*.log
sitemap.xml
sitemap.xml.gz

What it does is that it first ignores everything within wp-content but then makes exceptions for the wp-content/themes/ and wp-content/plugins/ folders.

like image 191
Jens Nilsson Avatar answered Oct 12 '22 23:10

Jens Nilsson