.gitignore exclude folder but include specific subfolder

后端 未结 17 1651
一个人的身影
一个人的身影 2020-11-21 06:36

I have the folder application/ which I add to the .gitignore. Inside the application/ folder is the folder application/language

17条回答
  •  故里飘歌
    2020-11-21 06:57

    gitignore - Specifies intentionally untracked files to ignore.

    Example to exclude everything except a specific directory foo/bar (note the /* - without the slash, the wildcard would also exclude everything within foo/bar):

    $ cat .gitignore
    # exclude everything except directory foo/bar
    /*
    !/foo
    /foo/*
    !/foo/bar
    

    Another example for WordPress:

    !/wp-content
    wp-content/*
    !/wp-content/plugins
    wp-content/plugins/*
    !wp-content/plugins/my-awesome-plugin
    

    More informations in here: https://git-scm.com/docs/gitignore

提交回复
热议问题