git忽略特定目录

Abb*_*bas 3 git github specification-pattern gitignore

我想最近在git上传我的dotnetnuke网站,现在我的网站有一些图像,我不想通过git上传.

我在GIT上搜索并遇到了在存储库创建期间创建的.gitignore文件,GIT有一个关于忽略文件/文件夹及其特定子文件夹的文档,但它似乎在我的情况下不起作用.

这是我的文件夹结构:

*******更新*******

.gitignore
public_html/Portals/_default/
public_html/Portals/0/
public_html/Portals/1/
public_html/Portals/110/
Run Code Online (Sandbox Code Playgroud)

现在我想忽略Portals下的所有文件夹,除了Portals/_default.我试过基于GIT的规范:

Example to exclude everything except a specific directory foo/bar (note the /* - without the slash, the wildcard would also exclude everything within foo/bar):

    $ cat .gitignore
    # exclude everything except directory foo/bar
    /*
    !/foo
    /foo/*
    !/foo/bar
Run Code Online (Sandbox Code Playgroud)

以下是我试过的:

!/Portals
/Portals/*
!/Portals/_default
Run Code Online (Sandbox Code Playgroud)

但这似乎根本不起作用.

谁能让我朝着正确的方向前进

msw*_*msw 5

gitignore的git 文档:

示例排除除特定目录foo/bar之外的所有内容(注意/* - 没有斜杠,通配符也会排除foo/bar中的所有内容):

$ cat .gitignore
# exclude everything except directory foo/bar
/*
!/foo
/foo/*
Run Code Online (Sandbox Code Playgroud)

田田!