Is it possible to make .gitignore changed according to environment variables
问题 Is it possible to add to .gitignore rules depends on environment variables? for example if -e $(ENV_VAR) "AAA" !liba.so else liba.so Basically what I want is to have a repository such that if ENV_VAR = "AAA" the local repository will have a.txt and if ENV_VAR isn't set the a.txt will be removed. 回答1: 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