Skip to content

Git doesn't have the correct default branch locally if you change the default branch in the remote #5

@connorshea

Description

@connorshea

I got stuck on this for a bit so I figure this might be useful to someone.

Git will not automatically update your local repository's default branch if the remote's default branch changes. So, if you change your default branch from master to develop, any copies of the repo cloned prior to the change will think master is the default branch, while any copies after the change will think develop is the default branch. This can cause the script to offer differing results depending on the machine you're on.

Solution: git remote set-head origin -a will update the branch that git considers the origin/HEAD to match the current default branch in the origin remote.

Source: Stack Overflow

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