4

When I run this command:

git --git-dir=firebird.git branch -a

This is my output:

  B1_5_Release
  B2_0_Release
  B2_1_Release
  B2_5_Release
* master
  remotes/B1_5_Release
  remotes/B2_0_Release
  remotes/B2_1_Release
  remotes/B2_5_Release
  remotes/B3_0_Release
  remotes/origin/B1_5_Release
  remotes/origin/B2_0_Release
  remotes/origin/B2_1_Release
  remotes/origin/B2_5_Release
  remotes/trunk

A B3_0_Release branch was created in Subversion after this git-svn tree was setup. I don't have a B3_0_Release tracking remotes/B3_0_Release, or something like this. This is a bare repository, so I can't do a "git checkout -b ...".

How can I add this new branch to this bare repository?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

3

The simplest way to create a branch in a git repository is git branch <branch_name> [<where to branch at>], which would work for bare repositories as well, in your case

git --git-dir=firebird.git branch B3_0_Release remotes/B3_0_Release

Beware it won't be updated automatically upon changes at the svn upstream (neither the other local branches probably).

Mykola Gurov
  • 8,517
  • 4
  • 29
  • 27
  • Worked, but now I do "git --git-dir=firebird.git push -u origin remotes/B3_0_Release:B3_0_Release" like I was doing for the others branches and it says: error: unable to push to unqualified destination: B3_0_Release The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. – Adriano dos Santos Fernandes Mar 02 '16 at 22:31
  • That's a completely different question which is easy to google/stackoverflow. You don't even have to create a local branch if all you want is to push to remotes, simply do `git push origin remotes/B3_0_Release:refs/heads/B3_0_Release` – Mykola Gurov Mar 02 '16 at 22:53