git .gitignore 文件中最适合 Wordpress 项目的设置是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13606938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:49:13  来源:igfitidea点击:

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

wordpressgit

提问by ivankoni

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

在 Wordpress 项目中使用 git 时,.gitignore 文件的推荐设置是什么?

回答by Dale

This is from GitHub's help files:

这是来自GitHub 的帮助文件

*.log
.htaccess
sitemap.xml
sitemap.xml.gz
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/wp-cache-config.php

回答by Jens Nilsson

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.

它的作用是首先忽略 wp-content 中的所有内容,然后对 wp-content/themes/ 和 wp-content/plugins/ 文件夹进行例外处理。