Is it possible to make .gitignore changed according to environment variables

前端 未结 3 1650
余生分开走
余生分开走 2021-01-27 06:27

Is it possible to add to .gitignore rules depends on environment variables?

for example

if -e $(ENV_VAR) \"AAA\"
!liba.so
else
liba.so

3条回答
  •  轮回少年
    2021-01-27 06:54

    The answer is no.

    Gitignore rules are completely static. Further that would not even make any sense. Once a file is in the repo, gitignore does not apply to it anymore – it only prevents new files from being added.

    That being said, you can have a local “gitignore”: anything in .git/info/exclude will also be ignored. Within the limits I just explained.

提交回复
热议问题