1

In git if I change a character in a line the entire line is considered changed.

I don't know much but stackexchange seem to track changes in a word-by-word basis in the edit history.
Is there an option to make git like that, or is there anything else that does this?

  • resource requests generally don't fare well on Programmers.SE. It would help your question if you explained why you think it's important to track down to that level of detail. – user53019 Jun 22 '13 at 20:31
  • @GlenH7 I was just intrigued. No actual purpose. – laggingreflex Jun 23 '13 at 1:23
7

I wouldn't say it's inherently true that git tracks lines, not words. Git stores snapshots of the entire source tree. It just happens to display differences between those trees as a line-based diff. But that's only the default way of displaying things. You can do git diff --word-diff to see a word-based diff which may be more useful in some cases. Do git help diff to see a zillion other flags you can pass to git diff.

  • 2
    Related answer on setting up git to use an external diff utility—if you're on a Linux system you probably have tkdiff installed which does a nice color-coded word-by-word diff of each line side by side. – dodgethesteamroller Jun 22 '13 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.