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

Re: Forcing rewrite of files in working tree

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 3, 2007, 19:55 UTC
Message-ID
<alpine.LFD.0.999.0708031251130.8184@woody.linux-foundation.org>
In-Reply-To
<200708031345.47127.andyparkins@gmail.com>
On Fri, 3 Aug 2007, Andy Parkins wrote:
Show 11 quoted lines
> 
> I want to write a little recipe in a Makefile that ensures the $Id$ field in a 
> series of text files is correct.  In case it's relevant, I'm including a load 
> of asciidoc files as subsections into one master file; each file has a $Id$ 
> field in the header, which very nicely prints out at the start of each 
> section.  However, the $Id$ field is only written on checkout (not on checkin 
> for fairly obvious reasons).  That means that for any files I've changed, the 
> $Id$ is wrong.  Before I generate output using ASCIIdoc I'd like to ensure 
> the $Id$ is correct.
> 
> How do I do it?
Something like
	git read-tree HEAD
	git checkout -f
should do it.

The read-tree basically invalidated the index, by forcing it to the HEAD tree (and *without* doing a merge with the old index, so it doesn't get any of the size/date/inode fields right). And at that point, git thinks that all files are stale, so "git checkout -f" will force the checkout for all of them.

I'm sure you can do it other ways too, but that's the "obvious" one.
			Linus
Previous: Andy Parkins
Message 4 of 4 in “Forcing rewrite of files in working tree”
  1. Andy ParkinsAug 3, 2007
  2. Rogan DawesAug 3, 2007
  3. Andy ParkinsAug 3, 2007
  4. Linus TorvaldsAug 3, 2007

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.