How to force Git to commit a file if it is recognized as unchanged
I have 2 binary files, which have
- exactly same size
- exactly same modification date
- exactly same creation date
- different content
If I replace one file with the other,
git does not recognize this file as changed.
Filesystem: NTFS, OS: Windows 7, Git Version: 1.9.0
(my workaround is to edit this new file to get a new modification date but I keep same content)
How can I force Git to commit the new file?
2 Solutions collect form web for “How to force Git to commit a file if it is recognized as unchanged”
You could always do
git rm --cached <file> git add <file>
This should put the new file into the index regardless of what was previously there.
Maybe you accidentally set the “assume unchanged” bit for the file’s path.
When the “assume unchanged” bit is on, Git stops checking the working tree files for possible modifications, so you need to manually unset the bit to tell Git when you change the working tree file.
To unset the “assume unchanged” bit, type:
git update-index --no-assume-unchanged <file>