Git 忽略仓库中修改的文件(如配置文件)不提交。

Set attrbiutes to filter in .git/info/attributes or .gitattributes

Text
Apps/Mjuanpi/Conf/config.php filter=nocache

Check you gitattributes information, it should print like the following:

Text
$ git check-attr -a Apps/Mjuanpi/Conf/config.php
Apps/Mjuanpi/Conf/config.php: filter: nocache

Config filter in .git/config or ~/.gitconfig

Text
[filter "nocache"]
smudge = sed -e \"s/HTML_CACHE_ON' => true/HTML_CACHE_ON' => false/g\"
clean = sed -e \"s/HTML_CACHE_ON' => false/HTML_CACHE_ON' => true/g\"

The “smudge” filter is run on checkout:
smudge filter
The “clean” filter is run when files are staged:
clean filter

References

这是一篇链接分享,请访问原文:
如何让 Git 忽略掉文件中的单/多行内容