bgreenlee / sublime-github

Sublime Text 2/3 plugin that provides a number of useful commands for GitHub.
MIT License
455 stars 98 forks source link

Support other default branches #123

Closed skeggse closed 2 years ago

skeggse commented 3 years ago

We use next-master for our primary development branch; some places use develop or main or default. It'd be great if the Open Remote URL in Browser (master) and related commands could be configured to use a different branch.

frjo commented 3 years ago

I would like this as well, all the repos I work on use "main".

MaxPhilips commented 2 years ago

I will have some time tomorrow August 6th to take a stab at this! I've been using this plugin recently on repos with other default branch names

MaxPhilips commented 2 years ago

@bgreenlee if you have a minute, could you check out the PR I've opened for this issue? thanks for the useful plugin!

nightpool commented 2 years ago

It would be really useful to detect this on a repo-by-repo basis, this change broke my workflow by changing "default" default branch from master to main. I'm in the progress of migrating my repos, but it would be great to have this "just work" automatically based on how the repo is configured. git symbolic-ref refs/remotes/origin/HEAD should be able to return the name of the github default branch for a given repository (if your GitHub remote is named origin). In the Github repo API response, it's available as default_branch. Not sure which approach would work best for the plugin, but having only one global "default branch" configuration variable is a little annoying when moving between projects.

MaxPhilips commented 2 years ago

Cool, that’s a good idea. I take your point that switching the default branch to any other name by default is a switch in functionality, which I tried to call attention to on the PR, so hopefully that was useful to you in diagnosing. I can find some time soon to try grabbing a default branch programmatically

In the mean time, can you use the default branch configuration to swap to whatever default branch your repos have?

On Tue, Sep 28, 2021 at 10:15 AM nightpool @.***> wrote:

It would be really useful to detect this on a repo-by-repo basis, this change broke my workflow by changing "default" default branch from master to main. I'm in the progress of migrating my repos, but it would be great to have this "just work" automatically based on how the repo is configured. git symbolic-ref refs/remotes/origin/HEAD should be able to return the name of the github default branch for a given repository (if your GitHub remote is named origin). In the Github repo API response, it's available as default_branch. Not sure which approach would work best for your project, but having one global "default branch" configuration variable is a little annoying.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bgreenlee/sublime-github/issues/123#issuecomment-929327474, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKAF3DFT3EHRSOLFVV5XLLUEHL2HANCNFSM4ZXR467A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nightpool commented 2 years ago

Yeah, I was eventually able to find the option and switch it back as a short-term workaround, since I'm just working in the one repo right now, but I can imagine it's going to continue being more and more of a pain as I move from repo to repo and have to keep updating it