Git always ignore the contents of a particular file line

I often use in the preparation of Z Shell file set -xto open debugging, but do not want to submit to the warehouse

solution

Git provides a file filters, this method can help remove when submitting set -x
us first to write a script, how to remove this line.
That the use ofsed "/^set -x$/d"

To filter a name, here to "DebugShell" for example. Add Filter

git config --local filter.DebugShell.clean 'sed "/^set -x$/d"'
git config --local filter.DebugShell. smudge 'sed "/^set -x$/d"'

Modifying .gitattributesthe file, using the filter for a particular file.

*.zsh filter=DebugShell

Guess you like

Origin www.cnblogs.com/zhuxiaoxi/p/11759319.html