I have following json file:
{
"UseSqlite": false,
"UsersAvatarsFolder": "uploads",
"UserDefaultPhoto": "no_image.jpg"
}
Now I want to tell git to ignore the "UseSqlite": false,
line So I followed this solution to ignore this specific line using .gitattributes
file:
*.json filter=ignoreSqlite
Then defined this filter in the gitconfig
:
git config --global filter.ignoreSqlite.clean 'sed "s/"UseSqlite": .*/"UseSqlite": true/"'
git config --global filter.ignoreSqlite.smudge cat
But it seems that, it doesn't work:
'sed: -c: line 0: unexpected EOF while looking for matching `''
'sed: -c: line 1: syntax error: unexpected end of file
error: external filter 'sed failed 1
error: external filter 'sed failed
On branch master
I am not sure about sed
syntax. Could you please take a look at it and let me know what's the correct syntax for it?
Update:
I finally fixed the syntax:
git config --global filter.ignoreSqlite.smudge "sed 's/"UseSqlite": .*/"UseSqlite": true,/'"
git config --global filter.ignoreSqlite.clean "sed 's/"UseSqlite": .*/"UseSqlite": false,/'"
But it also doesn't work, I want when I push the modification, the "UseSqlite"
be true
and when I pull the "UseSqlite"
be false
. But these filters don't work like that, Any idea?