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

but

  • Why shouldn't I push a virtualenv to Heroku?
  • Git-commit unable to open vim
  • gitignore file for SQL Server project: SSIS / SSAS / SSRS?
  • Hide a string in a file before git commit
  • Git branch names are OS dependent?
  • Push to GitHub fails when using git protocol
    • 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?

  • git push --recurse-submodules=on-demand is not truly recursive
  • Why is git core.preloadindex default value false?
  • “SSL host could not be verified” error
  • How do I submit another pull request once the first one was merged?
  • Bitbucket, Windows and “fatal: could not read Password for”
  • GIT HOOK to check keyword “PROMOTE” in message when GIT MERGE is executed
  • 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>
    
    Git Baby is a git and github fan, let's start git clone.