https://stackoverflow.com/questions/4250063/how-to-gitignore-all-files-folder-in-a-folder-but-not-the-folder-itself/5581995#5581995

put this .gitignore into the folder, then git add .gitignore

*
*/
!.gitignore

The * line tells git to ignore all files in the folder, but !.gitignore tells git to still include the .gitignore file. This way, your local repository and any other clones of the repository all get both the empty folder and the .gitignore it needs.

Edit: May be obvious but also add */ to the git ignore to also ignore sub folders.

How to .gitignore all files/folder in a folder, but not the folder itself?的更多相关文章

  1. CMake Error at cmake/OpenCVModule.cmake:295 (message): No extra modules found in folder:Please provide path to 'opencv_contrib/modules' folder

    其实,我们使用的opencv中要用的contrib/modules   是需要额外下载并在cmakelists.txt中指定的 git clone https://github.com/opencv/ ...

  2. Mac下Git项目使用的.gitignore文件

    https://www.gitignore.io/ 这个网站可以搜索特定项目.系统所需要的.gitignore 我现在主要是在Mac上用Visual Studio Code进行开发,所以直接搜索Mac ...

  3. git路径超长 及gitignore

    1 忽略路径超长 git config --system core.longpaths true 2 比较全的gitignore https://www.gitignore.io/api/vim,no ...

  4. 官方VisualStudio.gitignore配置

    官方地址 https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 示例 ## Ignore Visual Stud ...

  5. The specified file or folder name is too long

    You receive a "The specified file or folder name is too long" error message when you creat ...

  6. How to: Synchronize Files by Using Managed Code

    The examples in this topic focus on the following Sync Framework types: FileSyncProvider FileSyncOpt ...

  7. Umbraco 上传文件到另一个文件夹,而不是media files

    If you want to upload there media files to another place in the same instance of IIS, for example a ...

  8. 从source folder 下将其所有子文件夹的*.* 文件拷贝到 target folder (不拷贝文件夹名仅拷贝文件)

    因本人较懒,一直认为电脑能做的就让电脑来做,所以写下这个批处理的小脚本方便工作. 场景:碰到要拷贝一个文件夹(source folder)下的多个子文件夹(sub-folder)的文件到指定文件夹下( ...

  9. List or delete hidden files from command prompt(CMD)

    In Windows, files/folders have a special attribute called hidden attribute. By setting this attribut ...

随机推荐

  1. 一百零四、SAP中ALV事件之十六,让ALV表格能点击修改

    一.上一篇我们写到生产的ALV表格,但是表格内容不支持修改,如果我们需要修改下图的数量,需要怎么操作呢 二.代码如下,设置 ls_fieldcat-edit = 'X'.   "允许编辑. ...

  2. 通过GlobalAddAtom,GlobalGetAtomName方式发送字符串

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  3. java排序,效率高的是哪种排序方法

    和所有其他语言是一样的.应该还是快速排序效率最高. public static void bubbleSort(int a[]) {int len = a.length;for (int i = 0; ...

  4. Python MySQL Limit

    章节 Python MySQL 入门 Python MySQL 创建数据库 Python MySQL 创建表 Python MySQL 插入表 Python MySQL Select Python M ...

  5. jedis的ShardedJedisPool链接池的扩容问题

    回顾上一篇文章jedis连接池的构建. 我们来分析ShardedJedisPool的基于客户端分片所可能带来的问题:扩容 ShardedJedisPool的节点扩容 .ShardedJedisPool ...

  6. CV_图像滤波[转]---python+opencv均值滤波,高斯滤波,中值滤波,双边滤波

    1.图像滤波算法(cv2) https://blog.csdn.net/qq_27261889/article/details/80822270 2.

  7. SpringMVC: JSON

    SpringMVC:JSON讲解 什么是JSON? JSON(JavaScript Object Notation, JS 对象标记) 是一种轻量级的数据交换格式,目前使用特别广泛. 采用完全独立于编 ...

  8. ZOJ - 3961 Let's Chat(区间相交)

    题意:给定一个长度为n的序列,A和B两人分别给定一些按递增顺序排列的区间,区间个数分别为x和y,问被A和B同时给定的区间中长度为m的子区间个数. 分析: 1.1 ≤ n ≤ 109,而1 ≤x, y  ...

  9. mongodb安装到配置问题

    一.所有问题 Xshell 连接不上 报错类型:Could not connect to '192.168.122.1' (port 22): Connection failed.原因:IP地址未生成 ...

  10. Day1-T3

    原题目 Describe:两个限制条件,求第三属性的最大和 code: #pragma GCC optimize(2) #include<bits/stdc++.h> using name ...