git .gitignore 文件夹内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14700835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:26:16  来源:igfitidea点击:

.gitignore a folder content

gitgitignore

提问by synergetic

Possible Duplicate:
Ignoring directories in Git repos on Windows

可能的重复:
忽略 Windows 上 Git 存储库中的目录

My web app has the following directory layout:

我的网络应用程序具有以下目录布局:

myapp/
    .gitignore
    .git/
        ...

    static/
            mytest.txt
            fgs.ico
    ledgerware/
        static/
            mytest.txt
            fgs.ico
        ...

I'd like to edit existing myapp/.gitignore file so that when git push it ignores all files inside myapp/ledgerware/static folder, but NOT myapp/static folder. Can someone help me with this?

我想编辑现有的 myapp/.gitignore 文件,这样当 git push 时它会忽略 myapp/ledgerware/static 文件夹中的所有文件,而不是 myapp/static 文件夹。有人可以帮我弄这个吗?

回答by FoolishSeth

Just make the line in .gitignoreas specific as you want it to be:

只需.gitignore按照您希望的方式制作该行:

ledgerware/static/*