Reputation: 2504
As far as I know, git stores revisions by saving changed lines. Running text documents like documentations or wordy LaTeX files, normally have very long lines or are forcefully broken after 80 characters. When one word is changed, it leads to a huge difference in changed lines which bloats up the git repository.
Is it possible to make git work by words instead of lines? I know that there is git diff --color-words
which outputs changed words in a more pretty format. But this does not affect how these changes are internally stored.
I also know the practice to reformat the documents to make them more fit for versioning, by beginning a new line after each sentence. But this would severly clutter the format of most documents while still only shrinking the problem to a sentence length.
In other words, can I configure git to regard the space character instead of the newline character when it creates a revision?
Upvotes: 4
Views: 836
Reputation: 90426
There's no better solution to this problem than to split your paragraphs into several lines.
I know that there is git diff --color-words which outputs changed words in a more pretty format. But this does not affect how these changes are internally stored.
This answer has good advice on dealing with LaTeX in git, along with this one for using latexdiff
with git.
Upvotes: 2
Reputation: 26381
Git doesn't store diffs. SVN does. Git generally stores the full blob. It also does packing to save space (when running git gc
or pusing to a remote), but again, that is not line-based as it uses a binary delta format. The only thing that is annoying is as you noticed the diff-ouptut. But that has nothing to do with the way that Git stores the data. You might want to read Is the git binary diff algorithm (delta storage) standardized?, the pack-file specs and section 9.2 and 9.4 of ProGit.
Upvotes: 4