本文介绍了如何.gitignore文件夹中的所有文件/文件夹,但不是文件夹本身?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检查一个空白的文件夹。我该怎么做?
I want to check in a blank folder. How can I do this?
推荐答案
您不能在git中提交空文件夹。如果你想要显示,你需要放入一些东西,即使是一个空的文件。
You can't commit empty folders in git. If you want it to show up, you need to put something in it, even just an empty file.
例如,添加一个名为.gitkeep的空文件到文件夹你想保留,然后在.gitignore文件中写:
For example, add an empty file called .gitkeep to the folder you want to keep, then in your .gitignore file write:
# exclude everything
somefolder/*
# exception to the rule
!somefolder/.gitkeep
提交您的.gitignore和.gitkeep文件,这样可以解决您的问题。
Commit your .gitignore and .gitkeep files and this should resolve your issue.
这篇关于如何.gitignore文件夹中的所有文件/文件夹,但不是文件夹本身?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!