{"thread":{"id":"14796","subject":"git-submodule add -b","startedAt":"2008-08-01T20:27:05Z","lastAt":"2008-08-01T20:27:05Z","messageCount":1,"participants":["Tim Olsen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"85925","messageId":"g6vrip$2pu$1@ger.gmane.org","threadId":"14796","inReplyTo":null,"subject":"git-submodule add -b","fromName":"Tim Olsen","fromEmail":"tim@brooklynpenguin.com","sentAt":"2008-08-01T20:27:05Z","receivedAt":"2008-08-01T20:27:05Z","isPatch":false,"sender":{"key":"tim@brooklynpenguin.com","avatar":"https://gravatar.com/avatar/a468fd97b6433c4d22252ca75017d30a55046f5715e67b83e62b00a0833deb22?d=mp&s=160"},"body":"The git-submodule man page says that the -b option to \"git-submodule\nadd\" is the \"Branch of repository to add as submodule.\"\n\nI get the error \"fatal: A branch named '1.x' already exists.\" when I try\nto use \"git submodule add -b\".  A sample session is below.  What am I\ndoing wrong?\n\ntolsen@neurofunk:~/git$ mkdir submodule-branch\ntolsen@neurofunk:~/git$ cd submodule-branch\ntolsen@neurofunk:~/git/submodule-branch$ mkdir sub\ntolsen@neurofunk:~/git/submodule-branch$ cd sub\ntolsen@neurofunk:~/git/submodule-branch/sub$ git init\nInitialized empty Git repository in\n/home/tolsen/git/submodule-branch/sub/.git/\ntolsen@neurofunk:~/git/submodule-branch/sub$ echo 1 > file\ntolsen@neurofunk:~/git/submodule-branch/sub$ git add file\ntolsen@neurofunk:~/git/submodule-branch/sub$ git commit -m v1\nCreated initial commit d5c185a: v1\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 file\ntolsen@neurofunk:~/git/submodule-branch/sub$ echo 2 > file\ntolsen@neurofunk:~/git/submodule-branch/sub$ git add file\ntolsen@neurofunk:~/git/submodule-branch/sub$ git commit -m v2\nCreated commit fb864b2: v2\n 1 files changed, 1 insertions(+), 1 deletions(-)\ntolsen@neurofunk:~/git/submodule-branch/sub$ git log\ncommit fb864b2d4d9dacd87e55d0be970baa5fc6a0972c\nAuthor: Tim Olsen <tolsen@limespot.com>\nDate:   Fri Aug 1 16:21:09 2008 -0400\n\n    v2\n\ncommit d5c185a7ea91b66b5df524b21bbe0daf40a456f4\nAuthor: Tim Olsen <tolsen@limespot.com>\nDate:   Fri Aug 1 16:21:03 2008 -0400\n\n    v1\ntolsen@neurofunk:~/git/submodule-branch/sub$ git checkout -b 1.x d5c185a7\nSwitched to a new branch \"1.x\"\ntolsen@neurofunk:~/git/submodule-branch/sub$ echo 1.1 > file\ntolsen@neurofunk:~/git/submodule-branch/sub$ git add file\ntolsen@neurofunk:~/git/submodule-branch/sub$ git commit -m v1.1\nCreated commit d9868c5: v1.1\n 1 files changed, 1 insertions(+), 1 deletions(-)\ntolsen@neurofunk:~/git/submodule-branch/sub$ git log\ncommit d9868c5dc837404834b44eca6d21930c4f352127\nAuthor: Tim Olsen <tolsen@limespot.com>\nDate:   Fri Aug 1 16:21:58 2008 -0400\n\n    v1.1\n\ncommit d5c185a7ea91b66b5df524b21bbe0daf40a456f4\nAuthor: Tim Olsen <tolsen@limespot.com>\nDate:   Fri Aug 1 16:21:03 2008 -0400\n\n    v1\ntolsen@neurofunk:~/git/submodule-branch/sub$ cd ..\ntolsen@neurofunk:~/git/submodule-branch$ mkdir super\ntolsen@neurofunk:~/git/submodule-branch$ cd super\ntolsen@neurofunk:~/git/submodule-branch/super$ git init\nInitialized empty Git repository in\n/home/tolsen/git/submodule-branch/super/.git/\ntolsen@neurofunk:~/git/submodule-branch/super$ echo dummy > dummy\ntolsen@neurofunk:~/git/submodule-branch/super$ git add dummy\ntolsen@neurofunk:~/git/submodule-branch/super$ git commit -m dummy\nCreated initial commit f1c41b6: dummy\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 dummy\ntolsen@neurofunk:~/git/submodule-branch/super$ cd ..\ntolsen@neurofunk:~/git/submodule-branch$ git clone super super2\nInitialized empty Git repository in\n/home/tolsen/git/submodule-branch/super2/.git/\ntolsen@neurofunk:~/git/submodule-branch$ cd super2\ntolsen@neurofunk:~/git/submodule-branch/super2$ git submodule add -b 1.x\n~/git/submodule-branch/sub\nInitialized empty Git repository in\n/home/tolsen/git/submodule-branch/super2/sub/.git/\nfatal: A branch named '1.x' already exists.\nUnable to checkout submodule 'sub'\ntolsen@neurofunk:~/git/submodule-branch/super2$ git status\n# On branch master\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       sub/\nnothing added to commit but untracked files present (use \"git add\" to track)\ntolsen@neurofunk:~/git/submodule-branch/super2$\n\nThanks,\nTim\n"}]}