【问题标题】:.gitignore is ignoring files in a directory.gitignore 忽略目录中的文件
【发布时间】:2015-08-24 14:12:13
【问题描述】:

我有一个 .gitignore 文件,我试图只让 git 查看 /wp-content/plugins/event-manager 和 /wp-content/themes/StringsV2 中的目录和文件。

主题的一个正在工作,但插件一个只包含目录并忽略所有文件。

# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
!wp-config.php

# Ignore everything in the "wp-content" directory, except the "plugins"
# and "themes" directories.
wp-content/*
!wp-content/plugins/
!wp-content/themes/

# Ignore everything in the "plugins" directory, except the plugins you
# specify (see the commented-out examples for hints on how to do this.)
wp-content/plugins/*
!wp-content/plugins/event-manager/

# Ignore everything in the "themes" directory, except the themes you
# specify (see the commented-out example for a hint on how to do this.)
wp-content/themes/*
!wp-content/themes/StringsV2/

任何想法哪里出错了?谢谢

【问题讨论】:

  • Git 不会包含目录,除非它们中有文件...你完成了git add wp-content/plugins/event-manager/ 吗?这应该跟踪目录并将其内部内容公开给 git。
  • 是的,我已经尝试添加,但仍然没有,它不跟踪文件
  • 是什么让您认为您的文件没有被包含在内?请编辑您的问题,并将git status 的输出提供给我们。

标签: wordpress git gitignore


【解决方案1】:

尝试 git check-ignore 以了解 git 如何忽略文件/文件夹,例如:

$ git check-ignore -v sql

从这篇文章中找到:Git is ignoring files that aren't in gitignore

【讨论】:

    猜你喜欢
    • 2016-04-05
    • 1970-01-01
    • 1970-01-01
    • 2017-06-29
    • 2017-09-19
    • 2021-06-07
    • 1970-01-01
    • 2019-09-12
    • 1970-01-01
    相关资源
    最近更新 更多