git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: getting git to ignore modifications to specific files

From
Chris Packham <judge.packham@gmail.com>
Date
Sep 1, 2010, 20:45 UTC
Message-ID
<4C7EBB5E.5080003@gmail.com>
In-Reply-To
<AANLkTi=cPzAAKsTR+_1sucF46Rez=yi2Okjz7RhcCZ20@mail.gmail.com>
On 01/09/10 12:12, Bruce Korb wrote:
Show 9 quoted lines
> On Wed, Sep 1, 2010 at 11:57 AM, Chris Packham <judge.packham@gmail.com> wrote:
>> I did a bit of googling and found
>>  git update-index --assume-unchanged
>>
>> Which works locally to stop git status from complaining. Is there anyway
>> for me to make a change to our clone (a .gitattribues entry?) so that
>> everyone can get this by default?
> 
> Isn't that what .git/info/exclude is about?

Not as far as I've been able to tell. .gitignore and .git/info/exclude are ways to tell git to ignore these untracked files so that they don't show up in the output of git status (and others).

In my case the file is tracked, I just don't care if it changes and I don't want git rebase/checkout to complain if I have local modifications to this file. Ideally I'd like git add INSTALL to treat it as if nothing changed but have git add -f INSTALL stage the changes.

Thinking about what I can do with the existing .gitattributes I could probably have a custom diff driver that always returns 0 (/bin/true perhaps) and a custom merge strategy of theirs (or something sensible) if needed. A clean/smudge filter of git update-index --assume-(un)changed may also be possible but I haven't tried it yet.

Previous: Bruce KorbNext: Joshua Juran
Message 4 of 9 in “getting git to ignore modifications to specific files”
  1. Chris PackhamSep 1, 2010
  2. Joshua JensenSep 1, 2010
  3. Bruce KorbSep 1, 2010
  4. Chris PackhamSep 1, 2010
  5. Joshua JuranSep 1, 2010
  6. Jonathan NiederSep 2, 2010
  7. Jan KrügerSep 2, 2010
  8. Michael J GruberSep 2, 2010
  9. Chris PackhamSep 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.