git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git add on existing sub-repository

From
Stefan Näwe <stefan.naewe+git@gmail.com>
Date
Jul 15, 2009, 13:50 UTC
Message-ID
<loom.20090715T134313-679@post.gmane.org>
I found a weirdness with git add and submodules. 
I did:
 - create 2 repos: subtest, mod1
 - cloned mod1 into subtest
 - in 'subtest': git add mod1
'mod1' gets added as a submodule, but no '.gitmodules' files is written.
Bug ? Feature ?
Thanks for any reply.
Stefan

P.S. Here's a 'script' log of what I did (git-make-initial simply creates a new repo with a single commit):

~/tmp$ git version git version 1.6.3.3

~/tmp$ cat ~/bin/git-make-initial
#!/bin/sh
me=$(basename $0)
if [ ! -z "$1" ]; then
	dir=$1
	test -d $dir || mkdir $dir
else
	dir=.
fi
test -d $dir/.git && (echo "$me: '.git' exists; Not creating initial commit" ; 
exit -1)
test -d $dir/.git || (cd $dir ; git init ; test -f .gitignore || cp 
.git/info/exclude .gitignore ; git add . ; git ci -s -m"Initial commit created 
by $me")
~/tmp$ git-make-initial subtest
Initialized empty Git repository in /home/naewe/tmp/subtest/.git/
[master (root-commit) 8ab9920] Initial commit created by git-make-initial
 1 files changed, 6 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
~/tmp$ git-make-initial mod1
Initialized empty Git repository in /home/naewe/tmp/mod1/.git/
[master (root-commit) 3671274] Initial commit created by git-make-initial
 1 files changed, 6 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore

~/tmp$ ls -la subtest mod1 mod1: insgesamt 11 drwxr-xr-x 3 naewe naewe 104 2009-07-15 15:38 . drwx------ 13 naewe naewe 6992 2009-07-15 15:38 .. drwxr-xr-x 8 naewe naewe 328 2009-07-15 15:38 .git -rw-r--r-- 1 naewe naewe 240 2009-07-15 15:38 .gitignore

subtest: insgesamt 11 drwxr-xr-x 3 naewe naewe 104 2009-07-15 15:38 . drwx------ 13 naewe naewe 6992 2009-07-15 15:38 .. drwxr-xr-x 8 naewe naewe 328 2009-07-15 15:38 .git -rw-r--r-- 1 naewe naewe 240 2009-07-15 15:38 .gitignore

~/tmp$ cd subtest ~/tmp/subtest$ git clone ~/tmp/mod1 Initialized empty Git repository in /home/naewe/tmp/subtest/mod1/.git/ ~/tmp/subtest$ git add mod1 ~/tmp/subtest$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: mod1 # # Modified submodules: # # * mod1 0000000...3671274 (1): # > Initial commit created by git-make-initial # ~/tmp/subtest$ ls -a . .. .git .gitignore mod1 ~/tmp/subtest$

Message 1 of 1 in “git add on existing sub-repository”
  1. Stefan NäweJul 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.