In a possibly misguided attempt at organizing branch names, I attempted to make two branches where one was a "subpath" of the other — say, "foo" and "foo/bar" — and git refused to make the second one:
error: 'refs/heads/foo' exists; cannot create 'refs/heads/foo/bar'
Considering how the .git/refs/heads
is organized, at least on my system, this makes sense — a branch is a file in heads
, but slashes in branch names create directories, and a single entry can't be a file and a directory at the same time.
However, I can't find this limitation mentioned in the documentation. Is it a formal restriction, or is it just an implementation limit that everyone learns to avoid?