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

Re: Git issue

From
Jeff King <peff@peff.net>
Date
Nov 1, 2016, 17:45 UTC
Message-ID
<20161101174526.e2tilsriz2fqaru3@sigill.intra.peff.net>
In-Reply-To
<BY2PR0601MB16400EAC3E9683841907F4B2A2A10@BY2PR0601MB1640.namprd06.prod.outlook.com>
On Tue, Nov 01, 2016 at 10:28:57AM +0000, Halde, Faiz wrote:
Show 10 quoted lines
> I frequently use the following command to ignore changes done in a file
> 
> git update-index --assume-unchanged somefile
> 
> Now when I do a pull from my remote branch and say the file 'somefile'
> was changed locally and in remote, git will abort the merge saying I
> need to commit my changes of 'somefile'.
> 
> But isn't the whole point of the above command to ignore the changes
> within the file?

No. The purpose of --assume-unchanged is to promise git that you will not change the file, so that it may skip checking the file contents in some cases as an optimization.

From "git help update-index":
      --[no-]assume-unchanged
	   When this flag is specified, the object names recorded for
	   the paths are not updated. Instead, this option sets/unsets
	   the "assume unchanged" bit for the paths. When the "assume
	   unchanged" bit is on, the user promises not to change the
	   file and allows Git to assume that the working tree file
	   matches what is recorded in the index. If you want to change
	   the working tree file, you need to unset the bit to tell Git.
	   This is sometimes helpful when working with a big project on
	   a filesystem that has very slow lstat(2) system call (e.g.
	   cifs).
	   Git will fail (gracefully) in case it needs to modify this
	   file in the index e.g. when merging in a commit; thus, in
	   case the assumed-untracked file is changed upstream, you will
	   need to handle the situation manually.
-Peff
Previous: Halde, FaizNext: Junio C Hamano
Message 2 of 9 in “Git issue”
  1. Halde, FaizNov 1, 2016
  2. Jeff KingNov 1, 2016
  3. Junio C HamanoNov 1, 2016
  4. Jakub NarębskiNov 7, 2016
  5. Philip OakleyNov 1, 2016
  6. Jeff KingNov 1, 2016
  7. Junio C HamanoNov 1, 2016
  8. Jacob KellerNov 4, 2016
  9. doc: update-index --assume-unchangedPhilip Oakley, Nov 1, 2016

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.