Empty repo handling with alternate initial branch names

Deleted user October 11, 2021

I believe there is a small issue with the "You have an empty repository" screen displayed by BitBucket Server 7.9.0 which could cause later problems for situations where the repositories are not intended to use the default "master" branch name any more. If an empty repo is created by the Project administrator with a default branch name of "main", I believe the instructions that show on the page for "My code is ready to be pushed" should be slightly different. Specifically, the line "git init" on those instructions should be "git init -b main". Otherwise, git will create the new repo with the default branch name matching that user's locally configured default branch name (which still defaults to "master"). The line "git push -u origin HEAD:main" will workaround this in the short term by setting up so that whatever their local branch name ends up being, it will be linked to the correct branch name on BitBucket. However, it still sets up a situation where they have a local branch that does not match names with its associated BitBucket branch.

1 comment

Deleted user October 11, 2021

After working with a developer with an older version of git installed, I realized that the git init -b option is relatively new (added in 2.28, was not present in 2.27). So instead my suggestion is to insert a "git branch -m main" command after the commit, but before the push. From my experiments, this works regardless of what the automatically generated branch name was, and git branch -m is supported as far back as I can find documentation for

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events