提交空文件夹结构(使用git) [英] Commit empty folder structure (with git)

查看:299
本文介绍了提交空文件夹结构(使用git)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目的根目录下有数据目录。它有图像目录和一些文件。例如:


  • data /

    • images /

      • image1.jpg

      • image2.jpg >

      • results.csv

      • r.txt

      • / ul>

        要在gitignore中写入什么,忽略来自data /目录(即results.csv和r.txt)的文件以及来自images /目录的文件(image.jpg,image2 .jpg,image3.jpg)?

        当我提交它时,资源库中的文件夹结构应该是:


        • 数据/

          • 图片/




        所以,我只是想要空的文件夹结构被提交。

        解决方案

        在Git中,你不能提交空文件夹,因为Git实际上并不保存文件夹,只保存文件。如果你真的希望它们是空的(即你没有可提交的内容),你将不得不在这些目录中创建一个占位符文件。


        I have data directory in project's root. It has images directory and some files. Here is example:

        • data/
          • images/
            • image1.jpg
            • image2.jpg
            • image2.jpg
          • results.csv
          • r.txt

        What to write in gitignore, to ignore files from data/ directory (that is results.csv and r.txt) and files from images/ directory (image.jpg, image2.jpg, image3.jpg)?

        When I commit it, folder structure in repository should be:

        • data/
          • images/

        So, I just want empty folder structure to be commited.

        解决方案

        In Git, you cannot commit empty folders, because Git does not actually save folders, only files. You'll have to create some placeholder file inside those directories if you actually want them to be "empty" (i.e. you have no committable content).

        这篇关于提交空文件夹结构(使用git)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆