Skip to content

get branch name on initialization #570

@hwchen

Description

@hwchen

Hi,

When initializing with git init, I want to be able to get the branch name before I've made a commit. I'm pretty sure git branch won't return it.

It looks like git status --porcelain --branch does, it returns a ## No commits yet on main. But I'm not sure how to replicate this in git2? Hopefully I just missed something simple.

Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions