Unable to create a branch with branch types if its prefix is occupied

Issue #17593 new
Kenta Yamamoto
staff created an issue

Unable to create a branch with branch types if its prefix is occupied

Summary

Due to Git spec, it's unable to create a branch if its prefix is preoccupied as other branch's name and vice versa.
This also possibly happens to branching model.

Steps to Reproduce

  1. Create a branch named "feature"
  2. Enable "Feature" in branching model configuration
    • Screenshot 2018-11-19 12.02.11.png
  3. Try creating a branch prefixed "feature/"
    • Screenshot 2018-11-19 12.02.01.png

Expected Results

The error message should clarify why branch creation fails like below or guide how to apply the workaround.

fatal: cannot lock ref 'refs/heads/release/20181119': 'refs/heads/release' exists; cannot create 'refs/heads/release/20181119'

Actual Results

The below error message is shown:

We couldn't create a branch
If this keeps happening, contact support.

Notes

The error can occur the other way round:

  1. Enable "Release" in branching model configuration
  2. Create a branch prefixed "release/"
  3. Try creating a branch named "release"
    • Screenshot 2018-11-19 12.00.36.png

In this case, the branch creation page better to make users unable to specify reserved names (feature, bugfix, hotfix, release).

Workaround

Rename or delete the pre-existing branch which blocks prefix.

Comments (4)

  1. Log in to comment