It prevents your computer from loading undesired piece of JavaScript in case of a MITM attack.
It doesn't prevent things if the server itself serve you malware, but that's another story.
Only if the site you were visiting was over HTTPS, which it was not in the Github attack. Saying that you should remove this certificate if you don't want to participate in the Github attack or similar attacks is simply not true.