Github: Ignoring whitespace?

Created on 8 Jan 2018  路  10Comments  路  Source: atom/github

I don't see an option in the settings to ignore whitespace. This is a major issue because beautifying and cleaning up code can cause changes in whitespace that we don't need to count as differences. In fact, counting whitespace changes as committable changes can make it difficult to see the real changes in the code?

Is there a way to ignore whitespace that I'm just not seeing?

enhancement git

Most helpful comment

For example, in GitKraken with whitespace showing in diffs you see this:
image

If the Ignore white space option is enabled, the diff shrinks to this:
image

Note that there are several edge cases to consider here, such as when _all_ changes are hidden by the option:
image

Or when the whitespace changes are "important" (new lines?):
image

These options are controlled in the git CLI tool with the common --ignore-all-space option, as well as the less common --ignore-space-change and ignore-blank-lines.

All 10 comments

You're looking for the atom/whitespace package instead, which does contain settings to not cleanup trailing whitespace.

No I'm not. I'm not talking just about trailing whitespace. I'm talking about indentation for one. I'm talking about a feature to make Git ignore whitespace when flagging something as a change.

It's this simple: Take a piece of code and increase its indent. I want to _not_ count that as a change to be committed. I don't see such a feature on the Github module. The whitespace module you mentioned doesn't say anything about giving Git the option to ignore whitespace.

Source Tree has this feature. I'm abandoning SourceTree for the Git modules because SourceTree is too slow and buggy. But this is a key feature that I need in order for the Github module to be a suitable replacement.

I said nothing about stripping whitespace from my documents.

For example, in GitKraken with whitespace showing in diffs you see this:
image

If the Ignore white space option is enabled, the diff shrinks to this:
image

Note that there are several edge cases to consider here, such as when _all_ changes are hidden by the option:
image

Or when the whitespace changes are "important" (new lines?):
image

These options are controlled in the git CLI tool with the common --ignore-all-space option, as well as the less common --ignore-space-change and ignore-blank-lines.

I agree, this would be a great addition, as long as the UX and staging experience works well with it.

Ah, my apologies!

Oh boy, this would sure be useful, especially on very old code bases. I spend way too much time scrolling through stuff I don't want to commit.

+1. I'm actually surprised that this doesn't exist yet in this otherwise robust piece of software.

is there any hope?

I've made most of the required changes in my fork: https://github.com/utkarshgupta137/github.

The only thing left to do is move the option from package settings to this screen. If someone can help me with it, it would be great!

A better way would be to highlight whitespace changes using a different/lighter color. You'll still have to scroll alot, but they would be easy to ignore.

Was this page helpful?
0 / 5 - 0 ratings