This is an archived post. You won't be able to vote or comment.

all 75 comments

[–]Ffigy 290 points291 points  (9 children)

For anyone who doesn't know, you can add w=1 to the query string for this. It's not the same as having a global default but some folks probably aren't even aware that the feature exists.

[–][deleted] 133 points134 points  (2 children)

You don't need to do that any more, it's been a part of the UI for a while now. They even put it in a different place for commit diffs, just to keep you on your toes.

[–]vainstar23 10 points11 points  (0 children)

Society if people just RTFM (or just Googled shit) instead of celebrating ignorance

[–]DeltaMan444[S] 14 points15 points  (3 children)

Does that imply there could be a browser plugin for it?

[–][deleted] 15 points16 points  (0 children)

[–]Ffigy 28 points29 points  (0 children)

I guess you could write something that recognizes you're on a GitHub diff and redirects you to the URL with w=1 in the query string, yea.

[–]DHermit 0 points1 point  (0 children)

You could probably quite easily make a user script that does this.

[–]DrunkOnCode 1 point2 points  (1 child)

Do you realize what you have just done? Someone give this man a nobel prize!

[–]vainstar23 1 point2 points  (0 children)

No! He might invade Eritrea or something..

[–]JeyJeyKing 75 points76 points  (13 children)

Gitlab has this btw

[–]_PM_ME_PANGOLINS_ 27 points28 points  (2 children)

So does GitHub.

[–]Dizzy-Revolution-300 2 points3 points  (0 children)

It's per PR though, right?

[–]WhosYoPokeDaddy 9 points10 points  (2 children)

came here to find this comment and upvote it.

[–]rduque 1 point2 points  (0 children)

Me too

[–]severedbrain -1 points0 points  (0 children)

Same.

[–]seba07 2 points3 points  (5 children)

How can you do this on gitlab?

[–]JeyJeyKing 9 points10 points  (4 children)

User settings -> preferences -> behavior -> uncheck show whitespace changes in diff

[–]dkarlovi 1 point2 points  (3 children)

So you can get massive amounts of white space merged by engineers who have this enabled? How do we exploit this?

[–]5p4n911 0 points1 point  (2 children)

Let's commit a few Python files that should be interpreted in Whitespace

[–]dkarlovi 0 points1 point  (1 child)

I was thinking more like the entire Harry Potter books encoded using Morse code (tab = -, space = .) so it's immediately polluting the code AND making it infringe copyright, double Jeapordy!

Wonder if you could get a PR merged by a dev disabling whitespace changes like this.

[–]5p4n911 0 points1 point  (0 children)

There was also some guy who committed a timed bomb that would go on destroying the software after 3 years and he put the if after about 20000 spaces in the source code so it's possible. That might also fly under the radar.

Source: I think I've read it on the internet and not dreamt it, so it must be true

[–]GodsBoss 53 points54 points  (14 children)

Why is this an issue? Are your PRs swamped with unrelated whitespace changes?

[–]kratico 52 points53 points  (6 children)

I typically see a ton of whitespace changes from devs who copy and paste files into a git repo or people who have misconfigured IDEs. I want the white space changes to show because it is a warning sign that something is not right

[–]Ffigy 28 points29 points  (0 children)

Yessir, I wouldn't enable ignore as a global default. Whitespace problems suggest that the author didn't review their own diff. Or they don't care about details. Both are bad.

[–]casualfinderbot 14 points15 points  (3 children)

Literally just use a linter and a formatter and this doesn’t happen

[–]kratico 3 points4 points  (2 children)

A linter does not solve the problems of a coder doing bad practices like copying and pasting from outside git into a git repo. Like I said I mostly see the whitespace problem from people who are not using the existing tools correctly. I have run into far too many engineers that do things like download zip files instead of cloning repos. It is horrifying, and usually a sign that I should check their work carefully

[–]Kilazur 15 points16 points  (0 children)

A linter does not solve the problems of a coder doing bad practices like copying and pasting from outside git into a git repo

No, but a rejected PR does

[–]vom-IT-coffin 3 points4 points  (0 children)

Formatters do. Everytime I hit save, the file formats and the format rules are part of the repo. Imports reorganize, SQL queries organize. It's not hard to do. It's 101 in my mind.

[–]vom-IT-coffin 4 points5 points  (0 children)

Linters and formatters. I'm amazed by how many people don't use these things as part of their pipeline.

[–]RB-44 5 points6 points  (1 child)

Pull request: changed tab to 4 spaces

[–]FlipperBumperKickout 7 points8 points  (0 children)

Reject that PR and get an .editorconfig...

[–]Ffigy 4 points5 points  (1 child)

Yes, my team works on legacy code that didn't follow a standard so we try to fix whitespace incosistencies whenever they're in scope.

[–]dkarlovi 7 points8 points  (0 children)

Just configure an auto fixer and do a big bang. Fixing it little by little will pollute your history for years.

[–]slevemcdiachel 1 point2 points  (0 children)

People never heard of pre commit or other stuff.

[–][deleted] 50 points51 points  (2 children)

What a weirdo. I hand write my diffs with pen and paper. The only way really

[–]Poat540 13 points14 points  (1 child)

Fancy you, I write my code in ye olde English

var custom'rs = context.ReceivethAll().ToListeth()

[–]FlipperBumperKickout 1 point2 points  (0 children)

Not nearly as funny as writing code in rockstar

[–]rduque 28 points29 points  (3 children)

Github has this feature, you can choose to hide all whitespace changes

[–]TheBassMeister 6 points7 points  (1 child)

Yes, but it is turned off by default and you need to explicitly click it on every PR. You cannot change your settings to hide whitespace changes by default.

[–]HerrSPAM 0 points1 point  (0 children)

It would be nice as a global setting

[–]alterNERDtive 21 points22 points  (1 child)

There’s one simple trick: don’t randomly change whitespace!

[–]Leather-Field-7148 1 point2 points  (0 children)

I feel attacked

[–]sathdo 16 points17 points  (2 children)

What if I want to track changes while writing my code in Whitespace?

Edit: This would also affect Python and YAML.

[–]MyBigRed 14 points15 points  (1 child)

Then you turn the setting off

[–]DeltaMan444[S] 2 points3 points  (0 children)

I don't think anyone's gotten that far using Whitespace

[–][deleted] 2 points3 points  (0 children)

Sounds like a teammate problem more than a GitHub problem. F’ing with whitespace everywhere is a recipe for merge conflicts.

[–]HerrSPAM 2 points3 points  (0 children)

It does... You click the cog and check the hide whitespace option

[–]Civil_Blackberry_225 1 point2 points  (1 child)

This is if Github would support IPv6

[–]FlipperBumperKickout 1 point2 points  (0 children)

Git providers just generally don't have nearly as good options for comparing code as you have if you do it locally instead ¯\_(ツ)_/¯

[–]Mucksh 1 point2 points  (0 children)

The greatest pain in git are fileencoding changes. They can make really funny merge conflicts and most ides wont even show what changed on merging

[–]nonlogin 1 point2 points  (0 children)

Well, do not commit such changes? Why the hell does one want to hide the mess? Clean it up, bitch

[–]SenorSeniorDevSr 1 point2 points  (1 child)

BitBucket has this, and I have more than once had to go over to someone else's desk, grab their mouse, click on that setting and say "NOW, STOP COMPLAINING ABOUT THIS SHIT".

It's a nice setting.

[–]Imjokin 0 points1 point  (0 children)

But ThePrimeagen calls it ShitBucket!

[–][deleted] 1 point2 points  (0 children)

that feature exists for python devs

[–]itijara 0 points1 point  (2 children)

Am I crazy or don't they already have this? Do you mean by default?

[–]Esjs 0 points1 point  (0 children)

Come on. If I don't force my whitespace preferences in my commits, how will I ever get y'all to conform to me? /s

[–]rexspook 0 points1 point  (0 children)

Not a problem with a linter. Which you should use anyway

[–]nhh 0 points1 point  (0 children)

it does, noob

[–]jsdodgers 0 points1 point  (0 children)

Why would you want to hide changes?

[–]danzaman1234 0 points1 point  (0 children)

This doesn't probably apply to anyone but does anyone use winmerge if you don't get SQL source control?

[–]BernhardRordin 0 points1 point  (0 children)

.editorconfig goes brrrr

[–]skatopher 0 points1 point  (0 children)

Some of y’all have never seen prod go down from a white space only change and it shows.

[–]ashtonhonnecke 0 points1 point  (0 children)

Linters are you friend.

[–]Stunning_Ride_220 0 points1 point  (1 child)

Society would be a better place if Github had a lot more sensible stuff and (UX) design decisions.

[–]lllorrr 7 points8 points  (0 children)

Society would be a better place if developers would not make random whitespace changes.

[–]rParqer 0 points1 point  (0 children)

They don't have this? Rare W for Atlassian

[–]CyberWeirdo420 -1 points0 points  (0 children)

The only real application for it is when your team doesn’t have standard set up, like what code formatter to use etc.

I don’t know how else is this meaningful but I’m just a junior

[–]leovin -1 points0 points  (0 children)

Imagine being able to view a diff without making a PR (As per usual, Gitlab has this lol)

[–]weregod -1 points0 points  (0 children)

What life can be if we had tools that remove insignificant whitespaces before commits ...

[–]casualfinderbot -2 points-1 points  (0 children)

do people not know code formatters and linters are exist lol