.gitignore 不会忽略特定文件
.gitignore doesn't ignore specific file
我在我的 repo 的根文件夹中有这个作为 .gitignore。
但是,最后的文件没有被忽略。
/*.*
wp-content/*
wp-admin/*
wp-includes/*
cgi-bin/*
well-known/*
# Files to not ignore
!/.gitignore
# Unignore theme folder
!wp-content/themes
!wp-content/themes/*
# Unignore plugins folder, but ignore all content
!wp-content/plugins
wp-content/plugins/*
# Unignore only cmpz folders
!wp-content/plugins/cmpz-*
wp-content/plugins/cmpz-product-feed/xml/google-shopping/feed-roof-tents.xml
是否存在不忽略以“cmpz-”开头的插件文件夹的问题?但是,如何忽略子目录中的文件?
将文件放入git忽略文件是第一步。但是 git 版本控制中的文件和文件夹不会自行删除。即使您已将它们添加到 .gitignore.
第二步是删除存储库中已有的文件。你可以很容易地做到这一点:
git rm -rf --cached .
git add .
在执行此操作之前不要忘记提交所有更改!
我在我的 repo 的根文件夹中有这个作为 .gitignore。 但是,最后的文件没有被忽略。
/*.*
wp-content/*
wp-admin/*
wp-includes/*
cgi-bin/*
well-known/*
# Files to not ignore
!/.gitignore
# Unignore theme folder
!wp-content/themes
!wp-content/themes/*
# Unignore plugins folder, but ignore all content
!wp-content/plugins
wp-content/plugins/*
# Unignore only cmpz folders
!wp-content/plugins/cmpz-*
wp-content/plugins/cmpz-product-feed/xml/google-shopping/feed-roof-tents.xml
是否存在不忽略以“cmpz-”开头的插件文件夹的问题?但是,如何忽略子目录中的文件?
将文件放入git忽略文件是第一步。但是 git 版本控制中的文件和文件夹不会自行删除。即使您已将它们添加到 .gitignore.
第二步是删除存储库中已有的文件。你可以很容易地做到这一点:
git rm -rf --cached .
git add .
在执行此操作之前不要忘记提交所有更改!