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