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

Re: How to exclude files from "git diff"

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Jan 5, 2010, 17:54 UTC
Message-ID
<37fcd2781001050954y778ba661n7cee6cda699968c2@mail.gmail.com>
In-Reply-To
<6dc9ffc81001050620q55c23072p93f58c8685d77f9d@mail.gmail.com>
On Tue, Jan 5, 2010 at 5:20 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Yes, I want those files in repository. They are for my personal use only.

If you modified some file locally and do not want to see and commit those modifications, you may want to use:

git update-index --assume-unchanged foo

After that, git will not notice any change to `foo'. So, 'git diff' and any other command (such git commit -a) will ignore those changes.

Warning: using  --assume-unchanged may result in losing your changes
if you switch between branches containing different versions of 'foo'.

Normally, when you try to do that, git will not allow switch to another branch saying that `foo' is modified. But using --assume-unchanged disables this check. But if you have the same `foo' on all branches then switching between branches will preserve your modifications.

Dmitry
Previous: H.J. LuNext: H.J. Lu
Message 4 of 7 in “How to exclude files from "git diff"”
  1. H.J. LuDec 18, 2009
  2. Jeff KingJan 5, 2010
  3. H.J. LuJan 5, 2010
  4. Dmitry PotapovJan 5, 2010
  5. H.J. LuJan 5, 2010
  6. Nguyen Thai Ngoc DuyJan 5, 2010
  7. Junio C HamanoJan 5, 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.