How To Disable Squash & Merge on Specific GitHub Branches
The article discusses an issue faced by developers at Hookdeck while using GitHub. They wanted different merging strategies for different branches, but GitHub always defaulted to the last used merge strategy. To address this problem, they built a Chrome and Firefox extension called "GitHub Contextual Merge Strategy". The extension preselects "create a merge commit" when the source branch is main, master, staging or preview, and otherwise selects "squash and merge". It uses MutationObserver to watch for changes in the DOM and webNavigation.onHistoryStateUpdated API to support single-page navigation. The extension has been successfully used by Hookdeck without any accidental squashes.
Company
Hookdeck
Date published
Aug. 15, 2022
Author(s)
Valérian Galliat
Word count
751
Language
English
Hacker News points
None found.