![]() ![]() The entire difference between a regular merge and a squash merge is that a squash merge does not record the relationship between the new commit on the branch youre merging into (i.e. This is not standard gitflow practice you would just do a normal merge. I didn't like the idea of running a background script but it seems that browsers optimized them in a way that they only run when triggered by specific events, here onHistoryStateUpdated, only on and when the path starts with /hookdeck! This means the extension overhead is very limited and that's a good thing. It sounds like youre using git merge -squash when you merge to master. Also, there are difference between rebase and merge which are a little too involved to address in a comment. It's slower, but you can see what you're doing. git rebase -i brings up an editor and lets you fine-tune the rebase. To my dismay, there's no web API allowing us to subscribe to the pushState events.Ī common solutions is to proxy the history.pushState function, but this isn't easily done in an extension since we don't have a shared global object with the page being manipulated ( unsafeWindow doesn't seem to be a thing anymore for security reasons).Īn alternative is to use the extensions API (), which was music to my ears until I realized that it only works from a background script and not a content script!įair enough, I refactored the extension to use a background script in order to hook into the navigation events and trigger the script accordingly. Suppose somebranch had contained not just one new commit, but instead, 5 or 10 or even hundreds of commits. git merge -squash does it all on the command line in one shot and you just hope it works. The symptoms: if you open a PR page directly, the extension works, but if you open any other page on GitHub and then browse your way to a PR page, it won't! ![]() You'll only need to tweak the URL host and prefix you want it to run on in () (by default we only run it on the GitHub Hookdeck organization).Īlso feel free to tweak the () file according to your own branching conventions and needs! ![]() We didn't publish this extension on the Chrome and Firefox store, but nevertheless you can easily clone it and install it using the developer mode to load unpacked extensions.īy default, it preselects “ create a merge commit” when the source branch is any of main, master, staging and preview, and otherwise selects “squash and merge”. The result: GitHub Contextual Merge Strategy. We realized we weren't the only ones with this issue, and decided to build an extension to mitigate it while GitHub addresses it natively in the meantime. Introducing the contextual merge strategy extension! ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |