search

Home  >  Q&A  >  body text

gitlab - git branch name case problem?

git checkout -b AB-123/master Created a new branch from master. Later, for the sake of naming convention, we need to change AB to lower case, so git checkout master git branch -d AB-123/master Delete this branch, and then git checkout -b ab-123/master again, and find that you have entered the current The branch is displayed in lowercase, and git branch and git branch -a still display AB-123/master in uppercase. I don’t know if it is git cache or The Mac system is not case-sensitive, so I struggled for a long time and couldn't figure it out. . .
In desperation, re git clone the project code, and then git checkout -b ab-123/master will display normally.

Attachment:

The two pictures are continuous from top to bottom, but the screenshot is broken. . .

I don’t know if anyone has encountered this problem? How to solve it?

大家讲道理大家讲道理2729 days ago1879

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-06-05 11:11:05

    There are two options

    1. Do not use the / symbol in the branch name, otherwise the AB-123 directory will be created first and then the heads file master. Since mac is not case-sensitive, you just change the directory name, and the subsequent master remains unchanged, so git does not Conflict detected

    2. The git branch -d command only deletes heads but does not delete the directory

    So after git branch -d, you can manually delete the corresponding directory

    rm -rf .git/refs/heads/AB-123
    rm -rf .git/logs/refs/heads/AB-123

    reply
    0
  • ringa_lee

    ringa_lee2017-06-05 11:11:05

    The git command is not case-sensitive. For example, if you have V1 v1, it will treat it the same. Encountered this problem

    reply
    0
  • Cancelreply