threads / discuss / 29484

git-svn branches with revision id's in name

Subject: git-svn branches with revision id's in name

## tl;dr

3 messages between Jan 30, 2012 and Feb 2, 2012.

replies: 2people: 3as markdown or json

Stephen Duncan Jr· Jan 30, 2012, 19:42 UTC · lore

A project I work on recently changed it's SVN structure, causing me to do a new git svn clone. The new structure is like this:

{project}/branches/
  /master
  /develop
  /qa
  /feature
    /feature1
    /feature2
  /release
    /release1
    /release2
  /hotfix
    /hotfix1
    /hotfix2
So I set up my svn-remote sections as follows:
[svn-remote "svn"]
  url = {url}
  fetch = {project}/branches/master:refs/remotes/trunk
  fetch = {project}/branches/develop:refs/remotes/develop
  fetch = {project}/branches/qa:refs/remotes/qa
  branches = {project}/branches/{feature,release,hotfix}/*:refs/remotes/*/*

This seems to have worked fine, for the most part, but unlike my previous git-svn checkouts, it has created several branches with revision numbers as part of the name:

$ git branch -a
* master
  remotes/develop
  remotes/develop@29271
  remotes/develop@32463
  remotes/develop@34103
  remotes/feature/xyz
  remotes/feature/xyz@26438
  remotes/feature/xyz@27542
  remotes/feature/xyz@35233

Why have these remote branches been created? What impact does this have on my checkout? Can I remove safely remove them? How? I was unable to figure out how to reference this behavior in order to search for information on it.

-- Stephen Duncan Jr www.stephenduncanjr.com

Carsten Fuchs· Feb 2, 2012, 12:24 UTC · re: Stephen Duncan Jr · lore

Re: git-svn branches with revision id's in name

Hi all,
Am 2012-01-30 20:42, schrieb Stephen Duncan Jr:
Show 16 quoted lines
> [...]
> $ git branch -a
> * master
>    remotes/develop
>    remotes/develop@29271
>    remotes/develop@32463
>    remotes/develop@34103
>    remotes/feature/xyz
>    remotes/feature/xyz@26438
>    remotes/feature/xyz@27542
>    remotes/feature/xyz@35233
>
> Why have these remote branches been created?  What impact does this
> have on my checkout?  Can I remove safely remove them?  How?  I was
> unable to figure out how to reference this behavior in order to search
> for information on it.

Same questions here. (I know how to remove them, but I'd love to learn and understand why they have been created.)

Any info would much be appreciated!

Many thanks and best regards, Carsten

-- 
    Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
           Learn more at http://www.cafu.de
Jehan Bing· Feb 2, 2012, 19:03 UTC · re: Carsten Fuchs · lore

Re: git-svn branches with revision id's in name

On 2012-02-02 04:24, Carsten Fuchs wrote:
Show 23 quoted lines
> Hi all,
>
> Am 2012-01-30 20:42, schrieb Stephen Duncan Jr:
>> [...]
>> $ git branch -a
>> * master
>> remotes/develop
>> remotes/develop@29271
>> remotes/develop@32463
>> remotes/develop@34103
>> remotes/feature/xyz
>> remotes/feature/xyz@26438
>> remotes/feature/xyz@27542
>> remotes/feature/xyz@35233
>>
>> Why have these remote branches been created? What impact does this
>> have on my checkout? Can I remove safely remove them? How? I was
>> unable to figure out how to reference this behavior in order to search
>> for information on it.
>
> Same questions here.
> (I know how to remove them, but I'd love to learn and understand why
> they have been created.)

Those are branches that have been deleted and then recreated later. In svn, you can always get a deleted branch back by checking out an old revision. But in git, branches are not part of the history, so when you delete a branch, it's completely gone, as if it never existed, taking with it any commit that has not been merged elsewhere. To prevent that loss, git-svn doesn't delete branches. But if the branch was re-created later in svn, you would get a conflict in git. So instead, git-svn rename the old branch by adding the revision number where the branch last existed, i.e. the revision before it was deleted.

So in the OP case, the branch "develop" was deleted at least 3 times, at r34104, r32464 and r29272. The last one may also have been deleted too but then it was not re-created so git-svn didn't rename yet.

← back to recent threads