忽略除.gitignore

时间:2017-09-24 20:04:03

标签: git gitignore

我正在尝试设置gitignore以排除除2之外的所有子目录。我已经包括了〜!〜这两个我想要包含但是Sourcetree不会选择它。

这是我的相关gitignore

# .gitignore
node_modules/
wp-content/plugins/
wp-content/upgrade/
!wp-content/plugins/export-tool
!wp-content/plugins/darwin_checkout_tracking

这两个文件被设置为不包括在内。在他们被排除之前。

2 个答案:

答案 0 :(得分:1)

/ *很重要,你必须这样做:

# .gitignore
node_modules/
wp-content/plugins/*
wp-content/upgrade/*
!wp-content/plugins/export-tool
!wp-content/plugins/darwin_checkout_tracking

它有效

答案 1 :(得分:0)

你可以试试这个:

# .gitignore
!wp-content
node_modules/
wp-content/plugins/*
wp-content/upgrade/*
!wp-content/plugins/export-tool
!wp-content/plugins/darwin_checkout_tracking