Skip to content

Detect default branch name in refresh-repository.php #25

@swissspidy

Description

@swissspidy

Feature Request

Describe your use case and the problem you are facing

Some commands still use a master branch while some use main

refresh-repository.php has master hardcoded though:

printf( "Switching to latest \033[33mmaster\033[0m branch...\n" );
system( "git --git-dir={$path}/.git --work-tree={$path} checkout master" );

Describe the solution you'd like

Detect which branch is the default and use that instead of hardcoded master.

Locally I use a command like git checkout $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') to achieve this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions