Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(git plugin): check for origin head #9879

Closed
wants to merge 1 commit into from

Conversation

AnatoleLucet
Copy link

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.

Changes:

Adds a condition in git_main_branch to check for the origin remote's HEAD.
Not all repos use master, main, or trunk as their default branch. Some might choose develop, release, etc... This change makes this a bit more dynamic while still keeping the fallbacks for (e.g.) local repos with no origin remote.

Other comments:

I'm not a pro in bash / zsh scripting, so there might be room for improvement here.

Adds a condition in `git_main_branch` to check for the origin remote's HEAD.
@ohmyzsh ohmyzsh bot added Area: plugin Issue or PR related to a plugin Plugin: git labels May 3, 2021
@mcornella
Copy link
Member

A version of this was released some time ago but removed after complaints that now gcd (git checkout develop) and gcm (git checkout main) did the same thing.

@AnatoleLucet
Copy link
Author

AnatoleLucet commented May 3, 2021

Then maybe origin's head could be the fallback if neither master, main, nor trunk exists?

@mcornella
Copy link
Member

I appreciate what you're trying to do, but we don't need to support all different configurations. The intent behind git_main_branch was to allow the transition from master to another branch name, and it's done that for the most common name alternatives. It doesn't need to do more.

@mcornella mcornella closed this Aug 10, 2021
@mcornella mcornella mentioned this pull request Aug 25, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: plugin Issue or PR related to a plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants