Skip to content

Add default_branch feature #531

Closed
Closed
@CAMOBAP

Description

@CAMOBAP

Subject of the issue

Currently, GitHub suggest renaming of default branch from master to main https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/

But in ruby-git in many places master used as the default branch https://github.com/ruby-git/ruby-git/blob/master/lib/git/base.rb#L345

My proposal to add new method git.default_branch which will do git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' master based on https://stackoverflow.com/a/44750379/902217

Your environment

  • version of git and ruby-git 1.9.0
  • version of ruby 2.6.7p197

Steps to reproduce

Expected behaviour

Have a possibility to get default branch

Actual behaviour

For now it's not possible to get default branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions