1

I created the following branch on my MAC machine: DevTasks/dev
Did some stuff and committed. I had to rename the branch to devTasks/dev. I am not able to do that.

When I run

git branch -m DevTasks/dev devTasks/dev

I received "a branch name devTasks/dev is already exists"

I also removed completely the branch DevTasks/dev and created the new branch devTasks/dev. This also did not help.

Is it possible to rename branch name to the same branch name with capital letters on a Mac?

legoscia
  • 39,593
  • 22
  • 116
  • 167
roeybh
  • 69
  • 5
  • I know there is a way to change it via .git/refs/head for example : mv .git/refs/head/DevTasks .git/refs/head/devTasks. I am not sure if it is safe or can cause other problems – roeybh Feb 15 '17 at 11:31
  • Couldn't you just choose a totally different name? – smarber Feb 15 '17 at 16:15
  • Possible duplicate with http://stackoverflow.com/questions/38493543/git-branch-name-case-sensitive-or-insensitive – Mincong Huang Feb 15 '17 at 16:39
  • The problem is, as @MincongHuang noted in a comment above (I'm not sure if StackOverflow will delete the comment if this gets closed as a duplicate), that on the Mac, branch names are sometimes (but not always!) case insensitive. See my answer to the other question for details. – torek Feb 15 '17 at 19:06

1 Answers1

0

Considering the case sensitive nature of branches on Mac, the safest workaround would be to:

  • rename DevTasks/dev into devTasks/dev2
  • making sure .git/refs/head/dev no longer exist
  • then rename devTasks/dev2 into devTasks/dev
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250