Git has an excellent tool to stage (and later commit) only partial changes in a file. I am looking for kind of inverse option: to force git to stage and commit the whole file in one hunk: “I know that really the whole file has changed – do not try to do it in parts”
This option would be practical when a file has changed so much that only some whitespaces here and there are common between versions. As far as I understand, git tries always to stage the file still in hunks and uses the common (whitespace lines) as split points.
gitonly stores complete files (at least from the front-end’s standpoint – the back-end object database will play some tricks with deltas for storage efficiency when it creates pack-files, but transactions to and from the object database are only in entire-file units). When yougit add -pto “store” “partial changes”, whatgitis really doing is generating an entirely new file for you that only contains the changes you specify, and storing that entire file. Depending on your work flow, this is one of the things that is sometimes criticized aboutgit, as you can in effect store files that have never really existed in the development process and have not been tested to make sure they compile and/or work correctly.