We have an automatically generated javascript file which is tracked in our git repository. The problem is that it includes a (useless) timestamp in a comment, which often creates trivial merge conflicts for us. I'd like to avoid having these conflicts.
I thought I had found a solution with .gitattributes and filter/smudge. I set it up in the following way, so that this timestamp line was stripped from the file upon commit or checkout:
.gitattributes:
<the file>.js filter=tsfilter <the file>.js smudge=tsfilter .git/config:
[filter "tsfilter"] clean = perl -pe \"s/\\/\\/.*<the pattern>.*$//\" smudge = perl -pe \"s/\\/\\/.*<the pattern>.*$//\" While this seems to have eliminated merge conflicts, it introduced another annoyance in that this file now remains in a constant state of modification. That is, 'status' stills shows it as modified since the local (pre-filtered) copy includes timestamp line (but the committed file does not).
Is there a better way to go about this which avoids the merge conflicts but also hides local changes to this part of the file?