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

Add default_branch feature #531

Closed
CAMOBAP opened this issue Jul 14, 2021 · 4 comments
Closed

Add default_branch feature #531

CAMOBAP opened this issue Jul 14, 2021 · 4 comments

Comments

@CAMOBAP
Copy link
Contributor

CAMOBAP commented Jul 14, 2021

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

CAMOBAP added a commit to CAMOBAP/ruby-git that referenced this issue Jul 15, 2021
CAMOBAP added a commit to CAMOBAP/ruby-git that referenced this issue Jul 15, 2021
Signed-off-by: Alex Bobrikovich <abobrikovich@gmail.com>
CAMOBAP added a commit to CAMOBAP/ruby-git that referenced this issue Jul 15, 2021
Signed-off-by: Alexande B <abobrikovich@gmail.com>
@stale
Copy link

stale bot commented Jan 9, 2022

A friendly reminder that this issue had no activity for 60 days.

@stale stale bot added the stale label Jan 9, 2022
CAMOBAP added a commit to CAMOBAP/ruby-git that referenced this issue Jan 31, 2022
Signed-off-by: Alexande B <abobrikovich@gmail.com>
@ronan-mch
Copy link

This would be a very helpful change.

@ronaldtse
Copy link

GitHub has since changed the default branch to main, accompanied by most in the industry.

Is it possible to merge this feature soon? It’s been a year and a half. I wonder if others who use ruby-git simply switch to vanilla command line git due to this…

@jcouball
Copy link
Member

jcouball commented Mar 4, 2023

PRs #636, #637, #638, and #639 addressed where ruby-git assumed 'master' as a default branch for various git commands.

PR #571 added Git.default_branch.

@jcouball jcouball closed this as completed Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants