Gijsv
Gijsv

Reputation: 47

Overriding filter with smudge and cat in git config locally

I have the global filter in order to scrub the output from my Jupyter notebooks. I use the following --global settings in git to do so:
.gitconfig:

filter.clean_ipynb.clean=/home/username/.scripts/ipynb_drop_output.py
filter.clean_ipynb.smudge=cat

.gitattributes:

*.ipynb filter=clean_ipynb

Now I have one repository where I wish to not use this filter, what is the best way to override this in the local repository?

Upvotes: 1

Views: 199

Answers (1)

torek
torek

Reputation: 489065

In the .gitattributes or $GIT_DIR/info/attributes file for the one repository in which you want to override this filter setting,1 use:

*.ipynb !filter

which reverts the filter setting to "unspecified".

This works for all attributes, not just filter. Because filter only operates when it's set to some particular value, -filter would work as well; and because filter only takes one value, filter=dummy would also work, as long as you have no filter.dummy.* settings. But !filter is the way to go.


1Use .gitattributes if you want new clones to copy this setting. Use $GIT_DIR/info/attributes if you want new clones not to copy this setting. This, too, is a general pattern.

Upvotes: 3

Related Questions