Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Userscript to disable the Merge button inside pull requests on certain github projects
// ==UserScript==
// @name Hide GitHub Merge Button
// @version 0.5
// @description Removes the merge button on a GitHub project, so you will remember to
// rebase/write a useful merge message.
// @match https://github.com/TheLevelUp/*/pull/*
// #updateURL https://gist.github.com/aripollak/4322621/raw/f44b6cd6e10aa38110bea2c483a64182cb1748b8/hide-github-merge.user.js
// ==/UserScript==
var main = function () {
var clearMergeButton = function() {
document.querySelector('.btn-group-merge').style.display = 'none';
document.querySelector('.btn-group-squash').style.display = 'none';
document.querySelector('.btn-group-squash').style.display = 'none';
};
setTimeout(clearMergeButton, 500);
// Merge button gets reset after you add a comment for some reason, so hide it then too
form = document.querySelector('form.js-new-comment-form')
form.addEventListener('submit', function() { setTimeout(clearMergeButton, 1000); });
};
main();
@vpodzime

This comment has been minimized.

Copy link

vpodzime commented Oct 19, 2015

'.merge-branch-action' needs to be '.js-merge-branch-action' now. But thanks for sharing this!

@aripollak

This comment has been minimized.

Copy link
Owner Author

aripollak commented Oct 26, 2015

@vpodzime updated, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.