简体   繁体   English

git忽略特定目录

[英]git ignore specific directories

I wanted to recently upload my dotnetnuke website on git, now my website has gigs of images which i don't want to upload over git. 我想最近在git上传我的dotnetnuke网站,现在我的网站有一些图像,我不想通过git上传。

I was searching on GIT and came across .gitignore file which gets created during repository creation, GIT has a documentation about ignorning files/folders and it's specific sub-folder, however it does not seems to work in my case. 我在GIT上搜索并遇到了在存储库创建期间创建的.gitignore文件,GIT有一个关于忽略文件/文件夹及其特定子文件夹的文档,但它似乎在我的情况下不起作用。

Here's my folder structure: 这是我的文件夹结构:

*******Updated******* *******更新*******

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

Now i want to ignore all folders under Portals except Portals/_default. 现在我想忽略Portals下的所有文件夹,除了Portals / _default。 I tried based on the specification from GIT: 我试过基于GIT的规范:

!/Portals
/Portals/*
!/Portals/_default

Below is what i tried: 以下是我试过的:

 !/Portals /Portals/* !/Portals/_default 

But this does not seems to work at all. 但这似乎根本不起作用。

Can anyone get me in right direction. 谁能让我朝着正确的方向前进

From the git documentation for gitignore : gitignore的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): 示例排除除特定目录foo / bar之外的所有内容(注意/ * - 没有斜杠,通配符也会排除foo / bar中的所有内容):

$ cat .gitignore
# exclude everything except directory foo/bar
/*
!/foo
/foo/*

Tada! 田田!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM