Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  GlenH7 Jun 22 '13 at 20:31
    
@GlenH7 I was just intrigued. No actual purpose. –  laggingreflex Jun 23 '13 at 1:23
add comment

1 Answer

up vote 7 down vote accepted

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.

share|improve this answer
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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