Hacker News new | ask | show | jobs
by iamthebest 4171 days ago
Yeah. For example:

  $ git branch fireos
  $ git branch fireos/feature-branch
  error: unable to create directory for .git/refs/heads/fireos/feature-branch
  fatal: Failed to lock ref for update: No such file or directory
This happens because creating 'fireos' branch stores the sha1 in file .git/refs/heads/fireos. But if you later want to create branch 'fireos/feature-branch', git needs to store the sha1 in .git/refs/heads/fireos/feature-branch. This is impossible because 'fireos' is a file and cannot be a directory. Path conflict.
2 comments

It gets even uglier when you don't discover those conflicts until a pull or push.
It can be solved with a right branch naming policy. E.g. where I work we usually name branches like "wp/BTS-number/1" for first attempt to do the BTS-number task, "wp/BTS-number/2" when we somehow need to try another approach or rebase or squash history, "wp/BTS-number/3" for next attempt and so on.

But its a global policy so "wp" and "wp/BTS-number" will always be a folder, and conflicts should never happen.