Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make git check every file's contents even though stat info may not have changed?

Tags:

git

I use git to distribute code to an embedded system. Sometimes files get corrupted without changing the mtime, and I want to re-check everything out. Git normally doesn't bother checking the sha of files where the stat info hasn't changed. How can I make it check?

I've tried with

git -c core.ignorestat=yes reset --hard

but that doesn't work.

like image 241
Trevor Blackwell Avatar asked Feb 17 '12 00:02

Trevor Blackwell


1 Answers

Try setting core.trustctime to false:

core.trustctime

If false, the ctime differences between the index and the working copy are ignored; useful when the inode change time is regularly modified by something outside Git (file system crawlers and some backup systems). See git-update-index(1). True by default.

(I haven't tried this, but it looks like it might do the trick.)

like image 87
Greg Hewgill Avatar answered Nov 15 '22 04:11

Greg Hewgill