git-svn cannot create a branch to follow SVN branching

I’m struggling with the following issue. When I continue fetching revisions from SVN with

git svn fetch

I’m getting the following error:

Found possible branch point:
=>, 72666 
Found branch parent: (refs/remotes/deep/branches/product-001) b685b7b92813885fdf 6b8e2663daf884bf504b14
Following parent with do_switch 
Successfully followed parent 
error: 'refs/remotes/deep' exists; cannot create 'refs/remotes/deep/branches/product-001'
fatal: Cannot lock the ref 'refs/remotes/deep/branches/product-001'.
update-ref -m r72667 refs/remotes/deep/branches/product-001 df51920e8f0a53f26507 c2679eb6a9dbad91e0d6: command returned error: 128

This happened because I was fetching revisions using the default filter for SVN branches:

[svn-remote "svn"]
    url =
    fetch = trunk:refs/remotes/trunk
    branches = branches/*:refs/remotes/*
    tags = tags/*:refs/remotes/tags/*

Now, I have the line below added, but it’s too late:

branches = branches/deep/branches/*:refs/remotes/deep/branches/*

I have tried to fix this by using git svn reset to remove all the commits. Actually I can see from the error message that git is trying right thing, but cannot because of the branch remotes/deep being existing.

I have tried to search for 2 possible solutions:
1. Remove that branch (remotes/deep), but as it is tracked by git as a remote, I was not able to find any solution for that.
2. Remove the whole history related to that branch. No success too 🙁

Does anybody know how to deal with my issue?

  • View a git diff-tree in a reasonable format
  • Install git or update git without apt-get or yum
  • How to clone a specific branch in git bitbucket
  • Net Start SSHD HELPMSG 3534
  • Git SVN, Unable to determine upstream SVN information from working tree history after git rebase
  • git-svn from the point of view of a git native user
  • Git filter-branch not rewriting all history
  • Checkout different SVN folder using Source Tree to push to WordPress plugin assets folder
  • 2 Solutions collect form web for “git-svn cannot create a branch to follow SVN branching”

    I’ve been finally able to fix the issue by performing the following 2 steps:

    1. Removing refs/remotes/deep from packed-refs
    2. Removing .git/logs/refs/remotes/deep

    But still have the issue with fetching. I need to use

    branches = branches/*:refs/remotes/*

    for normal branches and

    branches = branches/deep/branches/*:refs/remotes/deep/branches/*

    for deep branches. Unfortunately the former specification includes the later, so I’m getting the error “fatal: Cannot lock the ref ‘refs/remotes/deep'” as git-svn tries to create deep branch according to the first spec.

    So far, I do that by manually commenting the first “branches” and fetching specific revisions with deep branches, but this is not a good options as there are too many revisions to fetch for both cases.

    UPD: I have found the simple but not elegant solution for the remaining issue. I’m using branches to specify paths to deep branches and fetch to specify every branch of the first level.

    I had a very similar problem, and found that “git svn reset”, not “git reset” fixed it. If you don’t update your branches configuration beforehand, once you retrieve a commit that passes a branch point, you have to back up to retrieve them again. Otherwise they are dangling with no parent.

    So, update your branches as before, then run

    git svn reset -r<revisionnum>

    and follow with your git svn fetch as normal. This saved me many hours of rebuilding the entire thing from SVN.

    In your case you probably also need to investigate the “ignore” features to not trace down your embedded branch.

    Git Baby is a git and github fan, let's start git clone.