我有文件夹application /我添加到.gitignore.应用程序/文件夹内是文件夹application/language/gr.我该如何包含此文件夹?我试过这个
application/
!application/language/gr/
Run Code Online (Sandbox Code Playgroud)
没有运气......
我的程序通常生成巨大的输出文件(~1 GB),我不想备份到git存储库.所以不是能够做到的
git add .
Run Code Online (Sandbox Code Playgroud)
我必须做点什么
git add *.c *.cc *.f *.F *.C *.h *.cu
Run Code Online (Sandbox Code Playgroud)
这有点麻烦......
我相信我可以编写一个快速的perl脚本,将目录内容写入.gitignore,然后根据.gitinclude(或类似名称)文件删除文件,但这似乎有点过于苛刻.有没有更好的办法?
不知道为什么这不起作用,因为我已经完成了这个加载!也许我有一个糟糕的一天......
我使用以下代码忽略除某些文件名和扩展名之外的所有文件
*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*.php
Run Code Online (Sandbox Code Playgroud)
出于某种原因,它只允许我提交.gitignore和readme.md,即使我在子文件夹中有php文件等.它有什么问题吗?只是fyi,我正在使用"git add -A"来获取要提交的文件.
提前致谢!
我从这篇文章中读到了解释为了使git跟踪文件夹,必须至少有一个空文件:
Currently the design of the Git index (staging area) only permits files
to be listed and nobody competent enough to make the change to allow
empty directories has cared enough about this situation to remedy it.
Directories are added automatically when adding files inside them.
That is, directories never have to be added to the repository,
and are not tracked on their own. You can say "git add <dir>" and it
will add the files in there. …
Run Code Online (Sandbox Code Playgroud)