News for hackers. Stuff that matters.
Re:Expanding Context in Diffs by yuvadam on Monday December 02, 2013 @09:28AM (#6833785)
I hoped they would fix line wrapping - which should be a relatively simply task - by now.

This is a very needed feature for projects that work a lot with text files (such as markdown) that do not automatically break on set widths (e.g. [1])

I've already contacted Github support with this request months ago, but no one's stepped up with a fix. Maybe this can get escalated somehow? Heck, I'd even submit a pull request if it was possible for github/github.

[1] - https://github.com/cryptoparty/handbook/pull/72/files

Re:Expanding Context in Diffs by bkeepers on Tuesday December 03, 2013 @02:24PM (#6842476)
https://github.com/blog/1707-soft-wrapping-on-prose-diffs

In your honor, I used an example from the cryptoparty handbook. Cheers!

Re:Expanding Context in Diffs by yuvadam on Tuesday December 03, 2013 @02:35PM (#6842559)
Made my day, Thanks! :)
Re:Expanding Context in Diffs by sdesol on Monday December 02, 2013 @10:48AM (#6834335)
I'm not sure I understand what you are referring to. Are you saying you want the long lines to be wrapped in the diff display? If so, I really can't see how this is an issue with GitHub since this is how the unified diff output is suppose to look like. Displaying it any differently would be misleading since it is a long line.
Re:Expanding Context in Diffs by ash on Monday December 02, 2013 @02:06PM (#6835699)
I think he wanted to see something like this instead:

http://f.cl.ly/items/0B2T3i1o1A3y062q0K1Z/Image%202013.12.02...

I don't find it too misleading. But long line could be made to look even more different (from multiple short lines) by having distinct color, typography marks etc.

Re:Expanding Context in Diffs by ngoldbaum on Monday December 02, 2013 @12:15PM (#6834908)
Why not add line breaks using your text editor? That will also help your collaborators who prefer not to wrap long lines.

I have a hook in my .emacs that turns on auto-fill-mode whenever I open a .md or .rst file. I'd assume there's something analogous for vim or whichever editor you normally work with.

Re:Expanding Context in Diffs by sdesol on Monday December 02, 2013 @03:38PM (#6836341)
I see this becoming a trend now, where long lines are used to make it easier to do diffs. I'm on the fence about this since there are pros and cons.
Re:Expanding Context in Diffs by gabemart on Monday December 02, 2013 @06:30PM (#6837384)
In text, hard line breaks can be content rather than presentation, so adding them to the raw file is not always desirable. It would be fantastic if the github web viewers offered this feature.

Also, won't it mess up diffs for wrapped text? If you add a few words in the middle of a paragraph and then re-wrap the text, won't the contents of every single following line be altered and show up as a diff?

Re:Expanding Context in Diffs by sdesol on Monday December 02, 2013 @07:40PM (#6837715)
Unified and side by side diffs were never really meant for diffing documents. If you do go the route of introducing line breaks to improve readability and/or editing, you really need to use a different diffing algorithm. What I've found useful is the Google diff match and patch library.

http://code.google.com/p/google-diff-match-patch/

Its extremely easy to integrate as well. You can see how it handles a markdown diff at:

http://ny.testdrive.gitsense.com/index?#pid=23&cid=27&trail=

Re:Expanding Context in Diffs by likeclockwork on Monday December 02, 2013 @08:24PM (#6837894)
git diff --word-diff
Re:Expanding Context in Diffs by potch on Monday December 02, 2013 @02:27PM (#6835863)
If you use a browser extension that allows for site-specific user CSS, the following does the trick beautifully:

.diff-line-pre { white-space: pre-wrap; }

Re:Expanding Context in Diffs by civilian on Monday December 02, 2013 @08:01PM (#6837806)
Which browser extension do you use for that?
Re:Expanding Context in Diffs by arantius on Tuesday December 03, 2013 @04:30PM (#6843336)
Re:Expanding Context in Diffs by jakub_g on Monday December 02, 2013 @12:10PM (#6834867)
Since we're touching code reviews, I'll plug my userscript here. It's useful for me for code reviews of big commits: you can fold the files, mark them as reviewed etc. and all of this is persisted in the local storage. You can install it from [1] if you know userscripts or read [2] otherwise.

[1] http://userscripts.org/scripts/show/153049

[2] https://github.com/jakub-g/gh-code-review-assistant

Re:Expanding Context in Diffs by obiterdictum on Monday December 02, 2013 @11:19AM (#6834553)
Worth noting that BitBucket had this as long as I can remember.
Re:Expanding Context in Diffs by ataggart on Monday December 02, 2013 @09:31AM (#6833806)
Side-by-side diffs would be superior.
Re:Expanding Context in Diffs by sdesol on Monday December 02, 2013 @04:10PM (#6836541)
I'm not sure if their stance has changed and I can't seem to find the answer that was given, but it had to do with aesthetics/layout. Basically their web layout width was too restrictive for showing side by side diffs. They only really have two options:

1) Do what Bitbucket does and have the side by side diff be a pop up window. I personally find this to be jarring and unnatural.

2) Combine both elements. It's what I do for my product. To better understand this take a look at

http://ny.testdrive.gitsense.com/index?#pid=22&cid=27&trail=

and switch to the side by side view. If you hover over the line number, you'll be able to see the diff line in unified mode below. With this setup they can provide side by side without having the user to constantly scroll left to right.

Re:Expanding Context in Diffs by tibbe on Monday December 02, 2013 @09:59AM (#6833984)
Aren't they complimentary? You can have a side-by-side diff without the extra context this change introduces.

That said, I also want side-by-side diffs. They're necessary for more complex diffs.

Re:Expanding Context in Diffs by stormbrew on Monday December 02, 2013 @12:30PM (#6835022)
Agree with the adjacent post that this is a complementary feature request and I also really want it. There is a browser plugin that can sort of get you there, but it's pretty brittle.
Re:Expanding Context in Diffs by shurcooL on Monday December 02, 2013 @02:07PM (#6835715)
> and the feature is available anywhere we render diffs

No, it's not available on gist.github.com.

Sure, they may (or may not) port it over after some time, but I just don't get why they can't use the same code in the first place. Why is GitHub reinventing the wheel in for its very own sub-site?

(Other than that, this is absolutely great!)

Re:Expanding Context in Diffs by philfreo on Monday December 02, 2013 @09:44AM (#6833891)
Nice! I've been wanting this feature for a long time:

http://philfreo.com/blog/the-problem-with-pull-requests-code...

Re:Expanding Context in Diffs by mduan on Monday December 02, 2013 @02:08PM (#6835722)
Since we're on the subject of Github's diff viewer, thought I'd throw in a plug for a chrome extension I wrote recently to improve it:

https://chrome.google.com/webstore/detail/github-enhancement...

Has side-by-side + word wrap + context (somewhat nicer looking than Github's, although could be biased)

Largely inspired by Phabricator's diff viewer.

Re:Expanding Context in Diffs by DanielRibeiro on Monday December 02, 2013 @10:16AM (#6834108)
Cool! Now the only thing missing is to integrate this[1] to natively support syntax highlight on diffs ;)

[1] https://github.com/danielribeiro/github-diff-highlight-exten...

Re:Expanding Context in Diffs by paddy_m on Monday December 02, 2013 @09:02AM (#6833647)
I was just looking for this over the weekend, and found it this morning.

When I talk about code to collaborators in email or chat, I always try to link to the file on github rather than just giving a path. I much prefer to recieve feedback that way. Maybe i'm not good enough with my text editor, but it is just a lot faster to get to the file that way.

Re:Expanding Context in Diffs by bencoder on Monday December 02, 2013 @09:09AM (#6833681)
Been needing this badly for reviewing changes to legacy code which tends to require a much larger context for understanding of a diff.

Hope it shows up in GH enterprise soon!

Re:Expanding Context in Diffs by bnferguson on Monday December 02, 2013 @11:01AM (#6834427)
AFAIK it should be in the next major release (330)!
Re:Expanding Context in Diffs by bcl on Monday December 02, 2013 @09:21AM (#6833753)
When working locally you can do something similar with -U<n> and I've also found using --patience can sometimes generate cleaner patches.
Re:Expanding Context in Diffs by alxndr on Monday December 02, 2013 @04:01PM (#6836488)
Fingers crossed for "default to ignore whitespace in all diffs" to be the next feature they roll out...
Re:Expanding Context in Diffs by staticshock on Monday December 02, 2013 @01:28PM (#6835426)
phabricator has had this feature forever. Here's an example diff: https://secure.phabricator.com/rP1b026fa6291fd86ed6a2e598e6a...
Re:Expanding Context in Diffs by johnny_reilly on Monday December 02, 2013 @12:24PM (#6834974)
I love these guys
Re:Expanding Context in Diffs by crassus on Monday December 02, 2013 @11:54AM (#6834777)
If any githubbers are reading, it would be great to be able to filter my organization's timeline events out of my personal timeline events. It's been bugging me for years. Thanks.
Re:Expanding Context in Diffs by stormbrew on Monday December 02, 2013 @04:13PM (#6836570)
Oh man yes please to this. The timeline is effectively useless right now.