I’ve been wanting to generate commands and menu items for some basic form of GitHub integration for Sublime Merge for a while now, finally completed it today (now with GitLab & Bitbucket support!).
The commands and menu items are implemented using a git alias which also allows command line usage if wanted:
open the repo: git open repo
open the current branch: git open branch
open the current commit: git open commit
create a pr on the current branch: git open pr
Each command supports an extra argument for specification:
open a specific branch: git open branch $specific_branch
open a specific commit: git open commit $specific_commit
create a pr on a specific branch: git open pr $specific_branch
open a specific tag: git open tag $specific_tag
Notes/Caveats:
the alias only works by default on macOS, changing the open command in the last line of step 1 (open "$repo_url") to a supported command by your OS is needed
opening local branches which names differ from the remote name
multiple remotes (opening branches on non-origin remotes)
Due to #1, the global commands now require build 2034 or newer. To support older builds, remove the $select_* argument from those commands (or copy from edit history).
I wish ST + SM supported at least GitLab. VSCode has this feature via GitLab Workflow. I wish I could manage issues/MRs/pipelines from ST (or even SM) at least on GitLab and GitHub. Other stuff would be useful too, like creating a repo, manage some stuff (the more, the better).
quick question. how to I add the aliases if I don’t use bash? Currently I run git on Windows 10 through mingit and posh-git. Basically I used scoop to download and add them to my PATH.
Thank you for this. All I had to do was replace the open at the end with powershell start. Sometimes it works. Sometimes it doesn’t. And what I mean by this is that I see the command executed with success in the Sublime Merge Git Output, but the URL won’t open the browser. And then I try running the command again and suddenly the URL to the repo opens in the browser.
Hi, I am on MacOS and running zsh. I have used this to add the alias to my gitconfig and when trying to view a commit on the remote (BitBucket), the browser opens the following URL: https://commit/commit/tree/0d4eb4bdc4a843f68c3f5404f66da6320305310f. Any ideas what could be wrong?
I am running Sublime Merge Build 2067 and system git is v.2.34.1.
@bitsper2nd Ah yes, that’s mine! Thanks for your interest! My version has a dependency on having a system-wide Python install with the py shortcut installed, and adds support for Azure DevOps repositories. I am interested in creating or contributing to a plugin once we get true plugin support for Sublime Merge, but this extension works for my current needs.
Big thanks to @srbs for the original implementation.