Git text versions
As far as I know, git keeps the changes by keeping the changed lines. Launching text documents such as documentation or LaTeX text files tend to have very long lines or get badly corrupted after 80 characters. When one word is changed, it results in a huge difference in the changed lines that are bloated in the git repository.
Is it possible to make git work with words instead of lines? I know there is git diff --color-words
one that outputs the changed words in a nicer format. But that doesn't affect how these changes are internally stored.
I also know the practice of reformatting documents to make them more suitable for version control, by creating a new line after each sentence. But this would greatly interfere with the format of most documents, but would only reduce the problem to the length of a sentence.
In other words, can I configure git to denote a space character instead of a newline character when it creates a revision?
source to share
Git does not store diff. SVN does. Git usually stores a complete blob. It also does packing to save space (on startup git gc
or pusing to remote), but again, this is not string dependent since it uses binary delta format. The only annoying thing is that you noticed diff-ouptut. But that has nothing to do with how Git stores data. You might want to read Is Git's binary algorithm (delta repository) standardized? , package specifications and ProGit section 9.2 and 9.4 .
source to share
There is no better solution to this problem than splitting your paragraphs across multiple lines.
I know there is git diff --color-words which outputs word changes in a nicer format. But that doesn't affect how these changes are stored internally.
This answer has good advice for working with LaTeX in git, as well as this one using latexdiff
with git.
source to share