GitHub squash reminder

Replaces the button if your current selected merge strategy is a merge commit

  1. // ==UserScript==
  2. // @name GitHub squash reminder
  3. // @include https://github.com/*/*/pull/*
  4. // @exclude none
  5. // @version 2
  6. // @grant none
  7. // @description Replaces the button if your current selected merge strategy is a merge commit
  8. // @author VasilisThePikachu
  9. // @namespace https://pikachu.systems
  10. // @license WTFPL
  11. // ==/UserScript==
  12.  
  13. function modifyMergeButton() {
  14. document.querySelectorAll('button.prc-Button-ButtonBase-c50BI').forEach(button => {
  15. if (button.textContent.trim() === "Confirm merge") {
  16. button.textContent = '⚠️ MERGE COMMIT SELECTED - Did you mean to squash? ⚠️';
  17. button.style.backgroundImage = 'linear-gradient(-180deg, #e02626 0%, #9F2D27 90%)';
  18. button.style.color = 'white';
  19. button.style.fontWeight = 'bold';
  20. }
  21. });
  22. }
  23.  
  24. function observeMergeButton() {
  25. const observer = new MutationObserver(modifyMergeButton);
  26. observer.observe(document.body, { childList: true, subtree: true });
  27.  
  28. // Run immediately in case the button is already there
  29. modifyMergeButton();
  30. }
  31.  
  32. // Start the observer
  33. observeMergeButton();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址