你如何让git忽略目录中的所有内容? [英] How do you get git to ignore all contents of a directory?

查看:98
本文介绍了你如何让git忽略目录中的所有内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含大量文件的git目录,然后有一个名为'sessions'的目录。 '会话'包含我的web.py程序的cookie信息。



我需要将文件夹'会话'保留在git存储库中,因为没有该文件夹,程序无法正常运行。我不需要将文件夹的实际内容存储在git目录中。



所以问题是:

如何让git忽略文件夹的内容而不是文件夹本身?

如果我记得正确地,您可以通过在会话文件夹中使用创建一个 .gitignore ^。] * 作为其内容。


I have a git directory which contains the a whole bunch of files and then has a directory called 'sessions'. 'sessions' contains cookie information for my web.py program.

I need the folder 'sessions' to remain in the git repository because without the folder the program does not function correctly. I don't need the actual contents of folder being stored in the git directory.

So the question is:

How can I get git to ignore the contents of a folder but not the folder itself?

解决方案

If I'm remembering correctly, you can do this by creating a .gitignore file in the sessions folder with [^.]* as its contents.

这篇关于你如何让git忽略目录中的所有内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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