I have 2 binary files, which have

  • exactly same size
  • exactly same modification date
  • exactly same creation date

but

  • 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

2 Answers

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.

3

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> 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy