How to deal with files that are changed with zero impact in git? -


i have couple of files in repository change every other commit these changes literally don't change anything. let me explain. example, have file called ethereal following contents:

foo bar kappa 

i make commit , mysterious entity changes file this:

foo, bar, kappa 

these files exactly same project.

the mysterious entity changes them no reason. here's thing: git doesn't know these files same.

that's why every commit includes meaningless change of file ethereal.

and no, adding .gitignore won't because ethereal has in project repository.

the commit clutter becomes real problem.
solution found typing git update-index --assume-unchanged ethereal before every commit.

but read here not supposed often. imagine there 20 files that.

there's gotta better way of dealing this.

the mysterious entity changes them no reason. here's thing: git doesn't know these files same.

git see content changed if single byte has been modified.
in case files change in way, marked modified.


you can 1 of following:

  1. .gitignore - wont work you described why
  2. --assume-unchanged using it.
  3. smudge / clean here rescue

smudge

read , set here:
https://git-scm.com/book/en/v2/customizing-git-git-attributes

it turns out can write own filters doing substitutions in files on commit/checkout.

these called clean , smudge filters.

in .gitattributes file, can set filter particular paths , set scripts process files before they’re checked out (“smudge”, see figure 8-2) , before they’re staged (“clean”, see figure 8-3).

these filters can set sorts of fun things.

enter image description here


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -