Ignoring all whitespace changes in diff including split/merged lines

My project is in C#, which is a language which ignores whitespace, both spaces and in particular newlines.

When entering the diff view in Github, I know I can use the ?w=1 url parameter to ignore whitespace.

But it doesn’t tend to completely ignore whitespace. If a line like so:

somethingLong + somethingAlsoLong

is transformed like this:

somethingLong +
somethingAlsoLong

Then I still get such changes showing up in the Github diff when my colleagues are reviewing it.

I understand such whitespace changes are meaningful in languages like Python but they’re not in C# and Resharper liberally applies them, including line splitting.

I guess it would be better if we force a Resharper run on all files before they are committed but that often hasn’t happened. So when I do a change I’ll run Resharper over the file but it will also hit functions I haven’t changed but in doing so pollute my commit.

The files probably should be normalised for spacing anyway but I’d rather when doing so it one can ignore the meaningless whitespace changes, including newlines, in the pull request diff view in GitHub so my reviewers know what I’ve really changed.

Anyway to achieve this?

1 Like

Hi @clintonmead,

Thanks for this feedback! We’re always working to improve GitHub, and we consider every suggestion we receive. I’ve logged your feature request in our internal feature request list. Though I can’t guarantee anything or share a timeline for this, I can tell you that it’s been shared with the appropriate teams for consideration.

Please let me know if you have any other questions.

Cheers!

Hi
You messaged me about my last name (Canfield ) is there a problem? ??

Hi there,

Apologies for any confusion; I didn’t message you. I know there’s a thread here where I let you know I moved your post. I will respond to your question there.

Cheers!

Hi nadiajoyce
Thank you for your help if its possible and yes it did confuse me as to my last name it is not a common name so I hear and all the Canfields I looked up are quite intelligent let’s hope I am once I learn coding eh

I also vote for this option!

In C++; C#; etc. being able to make the destinction between formatting changes and code changes are essential!

The diff/merge tools need to have the option to ignore all whitespace so only the code changes are tracked. It is easy to reformat in your IDE/editor of choice but getting “Conflict” for formatting changes is just wrong. All the diff tools I use/used have this option so this needs to be addressed.

Can we use a different diff tool to perform the diff/merge functions?

I ran into the same issue, ?w=1 doesn’t ignore newline whitespace. Is this still request still being considered?