{"thread":{"id":"24940","subject":"getting git to ignore modifications to specific files","startedAt":"2010-09-01T18:57:03Z","lastAt":"2010-09-02T19:40:04Z","messageCount":9,"participants":["Chris Packham","Joshua Jensen","Bruce Korb","Joshua Juran","Jonathan Nieder","Jan Krüger","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"149582","messageId":"4C7EA1FF.8030307@gmail.com","threadId":"24940","inReplyTo":null,"subject":"getting git to ignore modifications to specific files","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-09-01T18:57:03Z","receivedAt":"2010-09-01T18:57:03Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"Hi,\n\nWe have a git repository that as some GNU build system (a.k.a.\nautotools) files, my current problem is with the INSTALL file but I\nsuspect there may be some others. These can get modified if you are\nrunning a different version of autotools from when the files were created.\n\nI've had various arguments about which autotools files should or\nshouldn't be included in our repositories. My general rule of thumb is\nthat if it is automatically generated then it shouldn't go into the\nrepository.\n\nThere are a couple of repositories that are local clones of 3rd party\nrepositories which have included the pesky auto-generated files so whle\nI can remove the offending files from repositories we control I need\nanother solution for the 3rd part ones.\n\nI did a bit of googling and found\n  git update-index --assume-unchanged\n\nWhich works locally to stop git status from complaining. Is there anyway\nfor me to make a change to our clone (a .gitattribues entry?) so that\neveryone can get this by default?\n\nThanks,\nChris\n"},{"id":"149583","messageId":"4C7EA439.2000901@workspacewhiz.com","threadId":"24940","inReplyTo":"4C7EA1FF.8030307@gmail.com","subject":"Re: getting git to ignore modifications to specific files","fromName":"Joshua Jensen","fromEmail":"jjensen@workspacewhiz.com","sentAt":"2010-09-01T19:06:33Z","receivedAt":"2010-09-01T19:06:33Z","isPatch":false,"sender":{"key":"jjensen@workspacewhiz.com","avatar":"https://avatars.githubusercontent.com/u/111687?v=4"},"body":"  ----- Original Message -----\nFrom: Chris Packham\nDate: 9/1/2010 12:57 PM\n> I did a bit of googling and found\n>    git update-index --assume-unchanged\n>\n> Which works locally to stop git status from complaining. Is there anyway\n> for me to make a change to our clone (a .gitattribues entry?) so that\n> everyone can get this by default?\nI don't think so (but I hope I'm wrong!).\n\nGood idea, though.  +1 from me for being necessary.\n\nJosh\n"},{"id":"149584","messageId":"AANLkTi=cPzAAKsTR+_1sucF46Rez=yi2Okjz7RhcCZ20@mail.gmail.com","threadId":"24940","inReplyTo":"4C7EA1FF.8030307@gmail.com","subject":"Re: getting git to ignore modifications to specific files","fromName":"Bruce Korb","fromEmail":"bruce.korb@gmail.com","sentAt":"2010-09-01T19:12:59Z","receivedAt":"2010-09-01T19:12:59Z","isPatch":false,"sender":{"key":"bruce.korb@gmail.com","avatar":"https://gravatar.com/avatar/86d91467dc7cc8466a9d133a7b93a5d21233052017c144c9a6f6f7e5110344d0?d=mp&s=160"},"body":"On Wed, Sep 1, 2010 at 11:57 AM, Chris Packham <judge.packham@gmail.com> wrote:\n> I did a bit of googling and found\n>  git update-index --assume-unchanged\n>\n> Which works locally to stop git status from complaining. Is there anyway\n> for me to make a change to our clone (a .gitattribues entry?) so that\n> everyone can get this by default?\n\nIsn't that what .git/info/exclude is about?\n"},{"id":"149586","messageId":"0C30F6D9-8CAF-4677-AA40-7D41A7303C61@gmail.com","threadId":"24940","inReplyTo":"4C7EA1FF.8030307@gmail.com","subject":"Re: getting git to ignore modifications to specific files","fromName":"Joshua Juran","fromEmail":"jjuran@gmail.com","sentAt":"2010-09-01T19:24:31Z","receivedAt":"2010-09-01T19:24:31Z","isPatch":false,"sender":{"key":"jjuran@gmail.com","avatar":null},"body":"On Sep 1, 2010, at 11:57 AM, Chris Packham wrote:\n\n> We have a git repository that as some GNU build system (a.k.a.\n> autotools) files, my current problem is with the INSTALL file but I\n> suspect there may be some others. These can get modified if you are\n> running a different version of autotools from when the files were  \n> created.\n>\n> I've had various arguments about which autotools files should or\n> shouldn't be included in our repositories. My general rule of thumb is\n> that if it is automatically generated then it shouldn't go into the\n> repository.\n>\n> There are a couple of repositories that are local clones of 3rd party\n> repositories which have included the pesky auto-generated files so  \n> whle\n> I can remove the offending files from repositories we control I need\n> another solution for the 3rd part ones.\n\nI ran into this at a previous job, except using Perforce, so the files  \nwere readonly and make failed.  My workaround was to comment out the  \nMakefile rules for rebuilding the autotools files.\n\nThe basic issues here are self-modifying code and mixing code and  \ndata.  The first is why I don't use autotools; the second is why I  \ndon't use make.\n\nJosh\n"},{"id":"149605","messageId":"4C7EBB5E.5080003@gmail.com","threadId":"24940","inReplyTo":"AANLkTi=cPzAAKsTR+_1sucF46Rez=yi2Okjz7RhcCZ20@mail.gmail.com","subject":"Re: getting git to ignore modifications to specific files","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-09-01T20:45:18Z","receivedAt":"2010-09-01T20:45:18Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 01/09/10 12:12, Bruce Korb wrote:\n> On Wed, Sep 1, 2010 at 11:57 AM, Chris Packham <judge.packham@gmail.com> wrote:\n>> I did a bit of googling and found\n>>  git update-index --assume-unchanged\n>>\n>> Which works locally to stop git status from complaining. Is there anyway\n>> for me to make a change to our clone (a .gitattribues entry?) so that\n>> everyone can get this by default?\n> \n> Isn't that what .git/info/exclude is about?\n\nNot as far as I've been able to tell. .gitignore and .git/info/exclude\nare ways to tell git to ignore these untracked files so that they don't\nshow up in the output of git status (and others).\n\nIn my case the file is tracked, I just don't care if it changes and I\ndon't want git rebase/checkout to complain if I have local modifications\nto this file. Ideally I'd like git add INSTALL to treat it as if nothing\nchanged but have git add -f INSTALL stage the changes.\n\nThinking about what I can do with the existing .gitattributes I could\nprobably have a custom diff driver that always returns 0 (/bin/true\nperhaps) and a custom merge strategy of theirs (or something sensible)\nif needed. A clean/smudge filter of git update-index\n--assume-(un)changed may also be possible but I haven't tried it yet.\n"},{"id":"149615","messageId":"20100902040909.GD29713@burratino","threadId":"24940","inReplyTo":"4C7EA1FF.8030307@gmail.com","subject":"Re: getting git to ignore modifications to specific files","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-02T04:09:09Z","receivedAt":"2010-09-02T04:09:09Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Chris Packham wrote:\n\n> There are a couple of repositories that are local clones of 3rd party\n> repositories which have included the pesky auto-generated files so whle\n> I can remove the offending files from repositories we control I need\n> another solution for the 3rd part ones.\n\nFWIW one half-solution that has worked well for me is to make a local\nclone without the autogenerated files and complain to upstream so the\nlocal clone becomes superfluous after a while.\n\nNaturally another solutions might work better, though.\n"},{"id":"149633","messageId":"20100902112531.160b09bd@jk.gs","threadId":"24940","inReplyTo":"4C7EA1FF.8030307@gmail.com","subject":"Re: getting git to ignore modifications to specific files","fromName":"Jan Krüger","fromEmail":"jk@jk.gs","sentAt":"2010-09-02T09:25:31Z","receivedAt":"2010-09-02T09:25:31Z","isPatch":false,"sender":{"key":"jk@jk.gs","avatar":"https://avatars.githubusercontent.com/u/1774?v=4"},"body":"Chris Packham <judge.packham@gmail.com> wrote:\n\n> I did a bit of googling and found\n>   git update-index --assume-unchanged\n> \n> Which works locally to stop git status from complaining.\n\nBe careful with that, as it's technically meant to be used for another\npurpose (e.g. slow filesystems). Notably, git reset --hard will still\nkill your local modifications. In your case it seems to be about\nautomatically generated files so it's no big problem, but it might\nstill cause a bit of confusion, so I thought I'd warn you anyway.\n\n-Jan\n"},{"id":"149635","messageId":"4C7F7A57.4030504@drmicha.warpmail.net","threadId":"24940","inReplyTo":"4C7EA1FF.8030307@gmail.com","subject":"Re: getting git to ignore modifications to specific files","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-09-02T10:20:07Z","receivedAt":"2010-09-02T10:20:07Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Chris Packham venit, vidit, dixit 01.09.2010 20:57:\n> Hi,\n> \n> We have a git repository that as some GNU build system (a.k.a.\n> autotools) files, my current problem is with the INSTALL file but I\n> suspect there may be some others. These can get modified if you are\n> running a different version of autotools from when the files were created.\n> \n> I've had various arguments about which autotools files should or\n> shouldn't be included in our repositories. My general rule of thumb is\n> that if it is automatically generated then it shouldn't go into the\n> repository.\n> \n> There are a couple of repositories that are local clones of 3rd party\n> repositories which have included the pesky auto-generated files so whle\n> I can remove the offending files from repositories we control I need\n> another solution for the 3rd part ones.\n> \n> I did a bit of googling and found\n>   git update-index --assume-unchanged\n> \n> Which works locally to stop git status from complaining. Is there anyway\n> for me to make a change to our clone (a .gitattribues entry?) so that\n> everyone can get this by default?\n\nFor tracking my git configuration including .gitk, I used\n\n[filter \"dotgitk\"]\n        clean = fgrep -v geometry\n\ntogether with an appropriate attribute for gitk.\n\nI don't know how your autogenerated files differ, but maybe you can set\nup a filter (or custom diff driver) which makes git think the files are\nequal though they are not, just like in my case (ignoring window\ngeometry changes for gitk).\n\nMichael\n"},{"id":"149673","messageId":"4C7FFD94.90901@gmail.com","threadId":"24940","inReplyTo":"4C7F7A57.4030504@drmicha.warpmail.net","subject":"Re: getting git to ignore modifications to specific files","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-09-02T19:40:04Z","receivedAt":"2010-09-02T19:40:04Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 02/09/10 03:20, Michael J Gruber wrote:\n> Chris Packham venit, vidit, dixit 01.09.2010 20:57:\n>> Hi,\n>>\n>> We have a git repository that as some GNU build system (a.k.a.\n>> autotools) files, my current problem is with the INSTALL file but I\n>> suspect there may be some others. These can get modified if you are\n>> running a different version of autotools from when the files were created.\n>>\n>> I've had various arguments about which autotools files should or\n>> shouldn't be included in our repositories. My general rule of thumb is\n>> that if it is automatically generated then it shouldn't go into the\n>> repository.\n>>\n>> There are a couple of repositories that are local clones of 3rd party\n>> repositories which have included the pesky auto-generated files so whle\n>> I can remove the offending files from repositories we control I need\n>> another solution for the 3rd part ones.\n>>\n>> I did a bit of googling and found\n>>   git update-index --assume-unchanged\n>>\n>> Which works locally to stop git status from complaining. Is there anyway\n>> for me to make a change to our clone (a .gitattribues entry?) so that\n>> everyone can get this by default?\n> \n> For tracking my git configuration including .gitk, I used\n> \n> [filter \"dotgitk\"]\n>         clean = fgrep -v geometry\n> \n> together with an appropriate attribute for gitk.\n> \n> I don't know how your autogenerated files differ, but maybe you can set\n> up a filter (or custom diff driver) which makes git think the files are\n> equal though they are not, just like in my case (ignoring window\n> geometry changes for gitk).\n> \n> Michael\n\nIn my case the file differs quite a lot (GNU copyright statement has\nbeen updated) so a simple clean filter like that won't work.\n\nOne question is if I could come up with a filter, would it even work to\nstop git status from saying its modified?\n\nI tried the custom diff\n\n  [diff \"ignoretracked\"]\n          command = true\n\nbut that didn't stop git status from saying it was modified. It did\nhowever make \"git diff\" show no differences as expected.\n\nThe best advice seems to be get the file removed. I've sent a patch\nupstream so hopefully that will fix the problem going forward.\n"}]}