2

I'm writing a paper and have been using a regular text editor to write it, someone else made edits using emacs, and massively changed the whitespace, no matter which flags I use (-w -b --ignore-space-*) I can't get a meaningful diff, unfortunately we have both made substantial changes. The paper is due today and I'm unsure how to proceed, is there a flag to tell git diff to ignore all whitespace (I mean every single new line, space, tab, etc)

Zack Newsham
  • 2,810
  • 1
  • 23
  • 43
  • Would `git diff --color=always --color-words --word-diff-regex='[^[:space:]]'` be (a bit) more helpful? (as in http://stackoverflow.com/a/8483211/6309) – VonC Feb 06 '15 at 17:11
  • `ediff` in emacs can show you more details about the changes. – choroba Feb 06 '15 at 17:12
  • Failing anything else, you can make reformatted copies of both versions (purely for diffing) in which all whitespace is normalised (e.g. regexp replace all whitespace instances with a single space), and then diff those. That will at least show you the actual content changes, provided you know how to visualise intra-line differences (otherwise you'll need to break the lines at useful places). – phils Feb 07 '15 at 02:09
  • @phils, this is pretty much what I did, I downloaded emacs and formatted my copy the same way he formatted his, then ran meld on it, I was surprised at how well that worked. I had assumed that it would have placed linebreaks in different places, but it did the trick. Sadly I can't test VonC idea as I no longer have the different formatted versions. But I'll star this for future reference. – Zack Newsham Feb 07 '15 at 02:36

0 Answers0