1

我正在使用 git 将我的本地文件上传到亚马逊网络服务,我遇到了这个问题:

我在 gitinore 文件中添加了一个文件夹(图像/成员),但是当我执行 git push 时,它在 AWS 上被删除。我只想忽略 images/members 文件夹下的任何文件和子文件夹,因为应用程序会在其下创建动态文件夹。

我做的步骤:

1) 在位于 web 根目录的 .gitignore 文件中添加以下行:

图片/会员/

2) 混帐初始化

3) 混帐添加。

4) git commit -m "test"

5) git aws.push

我的所有更改都已发布,但文件夹成员但是当我的应用程序中的成员在图像/成员下创建一个文件夹时,当我执行另一个 git aws.push 时它会被删除。我只想忽略文件夹而不是删除它。

谢谢

4

1 回答 1

0

如果 git 已经在跟踪这些文件,那么您将不得不将git rm它们添加回来。

有可能另一个 .gitignore - 全局或该目录中的设置覆盖设置,请参阅手册页条目以获取优先级:

order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome): Patterns read from the command line for those commands that support them.

   o   Patterns read from a .gitignore file in the same directory as the path, or in any
       parent directory, with patterns in the higher level files (up to the toplevel of the
       work tree) being overridden by those in lower level files down to the directory
       containing the file. These patterns match relative to the location of the .gitignore
       file. A project normally includes such .gitignore files in its repository, containing
       patterns for files generated as part of the project build.

   o   Patterns read from $GIT_DIR/info/exclude.

   o   Patterns read from the file specified by the configuration variable core.excludesfile
于 2012-11-16T18:12:33.003 回答