I have 2 binary files, which have
but
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?
The --force option must be used to push an amended commit. The above example assumes it is being executed on an existing repository with a commit history. git commit --amend is used to update the previous commit. The amended commit is then force pushed using the --force option.
Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area. We also say that they will be staged.
Without adding any files, the command git commit won't work. Git only looks to the staging area to find out what to commit. Staging, or adding, files, is possible through the command line, and also possible with most Git interfaces like GitHub Desktop by selecting the lines or files that you'd like to stage.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With