The Abomination that Github calls “Suggested Change”
I am known for being not the biggest fan of #github anymore, especially since #Microsoft aquired them for a shitload of money. But when I recently learned about the “Suggested Change” feature, I lost any believe in them. How bad can one mess up a feature?
So, the “Suggested Change”-Feature, as I call it, provides a way to request changes on a pull request. A user can suggest a snippet of code being altered in a way they think is appropriate, by selecting the line from the diff in the PR that needs to be changed, and providing some replacement.
That replacement then is suggested to all who have write access on the source branch (most of the time, also maintainers of the target repository because of a checked-by-default option in PRs) and can be applied by them.
That's everything. There can be discussion on the change, of course, but that's the whole feature. It's even somewhat useful! But the way GitHub implemented this is just a load of pure shit.
The first thing is: they make you write change suggestions for Code in a Markdown-Editor! I mean... its not like code editors in web browsers are a new thing, or even an uncommon thing. But GitHub thinks otherwise and you're completely left alone, with a non-monospaced font, figure out how many spaces (or tabs, anyone?) you need on your own! GitHub does not care! You want to fix indentation of the code in there? Haha! Good luck with that! Oh, you accidentally suggested trailing whitespace! Well, GitHub cannot help you with that, because they don't know what a code editor is! In fact, your change suggestion is actually a markdown formatted comment with the diff being a markdown code block. What the hell?
Had enough already?
Next thing: you cannot provide a sensible change description, elsewhere known as commit message. You've probably never heard of that, GitHub, have you? Well, that's not entirely true though: The person who accepts your suggested change can. Yep, that's right! Not the author of the diff provides the commit message, but the committer. Nontrivial changes with “Update” as message anyone?
But even worse is that github actually thinks that suggested changes should not even be patches. How full of shit can they be? They implemented a feature to suggest changes on a pull request and these changes are NOT patches. There is no patch you can
git-fetch, nothing you can
git-cherry-pick or even
git-merge on your own machine. Everything you can do is go to the website, click the “Apply suggested change” button, which creates new commits on your PR branch and then fetch your own PR branch. There's no way to fetch the changes beforehand and review them locally, using your favorite tooling. This is the known Embrace-Extend-Extinguish bullshit that Microsoft pulled for years!
My suggestion: If you can, run away from GitHub as fast as you can. This ship will sink at some point, either because the community recognizes how badly they are messing things up, or because Microsoft makes the whole thing into some real enterprise: slow, complicated to use and only with paid access. If you cannot, for whatever reason, leave GitHub at this point, I suggest you gradually move away from it: make use of other git hosting providers, learn how to use alternatives, learn how to contribute via email and/or even roll your own git hoster – with gitolite and cgit it is almost trivial, and hosters that allow you to deploy such software exist – I like to suggest you have a look at uberspace for a really good and reasonably priced one (I am not and never have been affiliated with/paid by them for saying/writing this).
How it could have been
You might ask how such a feature would have been implemented properly. Well, given the circumstance that GitHub is a web service and users are wanted on the platform for as long as possible, I would have implemented this as follows:
- If you want to suggest changes you get a monospace-ready web-based code editor with syntax highlighting and maybe even a minimal autocompletion feature. The editor boots with your cursor at the position you initially clicked on in the changset you try to alter.
- You annotate your suggested change with your own commit message, or optionally use the “!fixup ” commit message header that can later be used in a
git rebase --autosquash.
- Once you're done adding your suggestions to the diff in the PR, you submit all your individual patches and you get a branch that builds on top of the PR branch, for example named
github.com/<your username>/<your repo clone>/<PR branch name>/suggestions-<N>.
- The PR author gets notified about the suggested changes and can
git-pullthem from your fork properly, review them locally and push them to their PR if they see fit or filter out what they don't like.
Everyone would be totally happy with that. For your dummy-users, you could have buttons and knobs to do the whole thing. Still, your power-users would be satisfied because they have the power to use their own infrastructure and tooling.
But once again, GitHub fails to deliver.