A caution about git branch names with ‘/’s

Git, you tricky bastard.

Let’s say I first create a branch named ‘wip/foo’:

git branch wip/foo

Git will create a file named ‘foo’ in the folder .git/refs/head/wip/. Now, suppose I attempt to create a new branch named ‘wip/foo/foo-offshoot’. git will return an error:

error: unable to create directory for .git/refs/heads/wip/foo/foo-offshoot
fatal: Failed to lock ref for update: No such file or directory

via coderwall.com : establishing geek cred since 1305712800.

Advertisement

Author: Adam Prescott

I'm enthusiastic and passionate about creating intuitive, great-looking software. I strive to find the simplest solutions to complex problems, and I embrace agile principles and test-driven development.

One thought on “A caution about git branch names with ‘/’s”

  1. I experienced the same and solved it by adding something like “/_” to each branch (in your case the branches would be named “wip/foo/_” and “wpi/foo/foo-offshot/_”).

    I also add extra folder structure to the repository itself. The top folders contain two folders: “meta” and “repo”, so meta-data I want to store along doesn’t interfere with the “real” data.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: