From: Tim Olsen <tim@brooklynpenguin.com>
To: git@vger.kernel.org
Subject: git-submodule add -b
Date: Fri, 01 Aug 2008 16:27:05 -0400 [thread overview]
Message-ID: <g6vrip$2pu$1@ger.gmane.org> (raw)
The git-submodule man page says that the -b option to "git-submodule
add" is the "Branch of repository to add as submodule."
I get the error "fatal: A branch named '1.x' already exists." when I try
to use "git submodule add -b". A sample session is below. What am I
doing wrong?
tolsen@neurofunk:~/git$ mkdir submodule-branch
tolsen@neurofunk:~/git$ cd submodule-branch
tolsen@neurofunk:~/git/submodule-branch$ mkdir sub
tolsen@neurofunk:~/git/submodule-branch$ cd sub
tolsen@neurofunk:~/git/submodule-branch/sub$ git init
Initialized empty Git repository in
/home/tolsen/git/submodule-branch/sub/.git/
tolsen@neurofunk:~/git/submodule-branch/sub$ echo 1 > file
tolsen@neurofunk:~/git/submodule-branch/sub$ git add file
tolsen@neurofunk:~/git/submodule-branch/sub$ git commit -m v1
Created initial commit d5c185a: v1
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file
tolsen@neurofunk:~/git/submodule-branch/sub$ echo 2 > file
tolsen@neurofunk:~/git/submodule-branch/sub$ git add file
tolsen@neurofunk:~/git/submodule-branch/sub$ git commit -m v2
Created commit fb864b2: v2
1 files changed, 1 insertions(+), 1 deletions(-)
tolsen@neurofunk:~/git/submodule-branch/sub$ git log
commit fb864b2d4d9dacd87e55d0be970baa5fc6a0972c
Author: Tim Olsen <tolsen@limespot.com>
Date: Fri Aug 1 16:21:09 2008 -0400
v2
commit d5c185a7ea91b66b5df524b21bbe0daf40a456f4
Author: Tim Olsen <tolsen@limespot.com>
Date: Fri Aug 1 16:21:03 2008 -0400
v1
tolsen@neurofunk:~/git/submodule-branch/sub$ git checkout -b 1.x d5c185a7
Switched to a new branch "1.x"
tolsen@neurofunk:~/git/submodule-branch/sub$ echo 1.1 > file
tolsen@neurofunk:~/git/submodule-branch/sub$ git add file
tolsen@neurofunk:~/git/submodule-branch/sub$ git commit -m v1.1
Created commit d9868c5: v1.1
1 files changed, 1 insertions(+), 1 deletions(-)
tolsen@neurofunk:~/git/submodule-branch/sub$ git log
commit d9868c5dc837404834b44eca6d21930c4f352127
Author: Tim Olsen <tolsen@limespot.com>
Date: Fri Aug 1 16:21:58 2008 -0400
v1.1
commit d5c185a7ea91b66b5df524b21bbe0daf40a456f4
Author: Tim Olsen <tolsen@limespot.com>
Date: Fri Aug 1 16:21:03 2008 -0400
v1
tolsen@neurofunk:~/git/submodule-branch/sub$ cd ..
tolsen@neurofunk:~/git/submodule-branch$ mkdir super
tolsen@neurofunk:~/git/submodule-branch$ cd super
tolsen@neurofunk:~/git/submodule-branch/super$ git init
Initialized empty Git repository in
/home/tolsen/git/submodule-branch/super/.git/
tolsen@neurofunk:~/git/submodule-branch/super$ echo dummy > dummy
tolsen@neurofunk:~/git/submodule-branch/super$ git add dummy
tolsen@neurofunk:~/git/submodule-branch/super$ git commit -m dummy
Created initial commit f1c41b6: dummy
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 dummy
tolsen@neurofunk:~/git/submodule-branch/super$ cd ..
tolsen@neurofunk:~/git/submodule-branch$ git clone super super2
Initialized empty Git repository in
/home/tolsen/git/submodule-branch/super2/.git/
tolsen@neurofunk:~/git/submodule-branch$ cd super2
tolsen@neurofunk:~/git/submodule-branch/super2$ git submodule add -b 1.x
~/git/submodule-branch/sub
Initialized empty Git repository in
/home/tolsen/git/submodule-branch/super2/sub/.git/
fatal: A branch named '1.x' already exists.
Unable to checkout submodule 'sub'
tolsen@neurofunk:~/git/submodule-branch/super2$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# sub/
nothing added to commit but untracked files present (use "git add" to track)
tolsen@neurofunk:~/git/submodule-branch/super2$
Thanks,
Tim
reply other threads:[~2008-08-01 20:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='g6vrip$2pu$1@ger.gmane.org' \
--to=tim@brooklynpenguin.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.