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

  1. *
  2. */
  3. !.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. python之os.exec*族用法简结

    os.exec*族主要用来代替当前进程,执行新的程序,不返回值.在UNIX上,新的执行程序加载到当前进程,与调用它的进程有相同的id. os.execl(path, arg0, arg1, ...) ...

  2. Java 第一次课堂测试总结。

    Java 第一次课堂测试总结. 昨天参加了JAVA的开学测试,课上没有完成计算基点的功能,以下是修改完成后的代码.  首先是ScoreInformation类来存储学生信息. //信1805-1 王正 ...

  3. java 学生信息管理

    题目: 一.测试要求:      1.按照测试内容要求完成程序的设计与编程:      2.将最终结果的源文件(.java)文件上传到以班级为单位,保存源程序.      3.建立学号姓名文件夹,如: ...

  4. JS图片多个上传,并压缩为Base64

    首先是JS 批量上传 HTML <div id="Pic_pass"> <p style="font-size: 20px;font-weight: b ...

  5. 11 ~ express ~ 解决 cookie 中文报错的问题

    使用cookies包需要注意:1,cookie中是不能有中文的,一旦有中文,就会报错2,cookie是通过 中间件的形式直接挂载到 req对象上的,那么cookies有的方法,req.cookies就 ...

  6. Vulkan SDK之 Swapchain

    Swapchain是一系列最终会展示给用户的图像的集合. /* * Set up swapchain: * - Get supported uses for all queues * - Try to ...

  7. 使用openssl做CA服务器,并且生成证书。

    [root@22 conf.d]# openssl genrsa -out /etc/pki/CA/private/cakey.pem 4096  #ca私钥 [root@22 conf.d]# op ...

  8. Flink与Spark Streaming在与kafka结合的区别!

    本文主要是想聊聊flink与kafka结合.当然,单纯的介绍flink与kafka的结合呢,比较单调,也没有可对比性,所以的准备顺便帮大家简单回顾一下Spark Streaming与kafka的结合. ...

  9. dfs第二遍重学

    ---恢复内容开始--- 1.先上个基础的全排列 #include<iostream> #include<cstring> using namespace std; const ...

  10. Redis: Reducing Memory Usage

    High Level Tips for Redis Most of Stream-Framework's users start out with Redis and eventually move ...