5 ms·
Yeah. For example: $ git branch fireos $ git branch fireos/feature-branch error: unable to create directory for .git/refs/heads/fireos/feature-branch f
by iamthebest 12y 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.
- JoshTriplett 12y agoIt gets even uglier when you don't discover those conflicts until a pull or push.
- maddening 12y agoIt 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.