login
Header Space

 
 

[rfc] git submodules howto

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Date: Tuesday, September 18, 2007 - 6:55 am

hi,

i saw several "is there any step by step howto on how to use git
submodules?" question on irc, and as far as i think there is none
available at the moment

here is how i use it at the moment:

$ mkdir lib
$ cd lib
$ git init
Initialized empty Git repository in .git/
$ echo "libmakefile" > Makefile
$ dg add Makefile
$ git commit -m "libmakefile"
Created initial commit 57c1dce: libmakefile
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 Makefile
$ cd ..
$ mkdir main
$ cd main
$ git init
Initialized empty Git repository in .git/
$ echo "main makefile" > Makefile
$ git add Makefile
$ git commit -m "main makefile"
Created initial commit 8935291: main makefile
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 Makefile
$ git submodule add ../lib lib
Initialized empty Git repository in /home/vmiklos/scm/git/sub/main/lib/.git/
0 blocks
$ git commit -m "added lib submodule"
Created commit 9dbfedf: added lib submodule
 2 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100644 .gitmodules
 create mode 160000 lib
$ cd ..
$ git clone main cloned
Initialized empty Git repository in /home/vmiklos/scm/git/sub/cloned/.git/
0 blocks
$ cd cloned
$ git submodule init
Submodule 'lib' (/home/vmiklos/scm/git/sub/lib/.git) registered for path 'lib'
$ git submodule update
Initialized empty Git repository in /home/vmiklos/scm/git/sub/cloned/lib/.git/
0 blocks
Submodule path 'lib': checked out '57c1dce0e083e9ee50d06111d6aa1523116c2e15'
$ cat Makefile
main makefile
$ cat lib/Makefile
libmakefile

my questions:

1) is this correct? :) i use it and it seem to do what i except, but
maybe it's not correct

2) does this worth adding to the documentation? maybe to a .txt under
Documentation/howto? or to git-submodule.txt?

thanks,
- VMiklos
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[rfc] git submodules howto, Miklos Vajna, (Tue Sep 18, 6:55 am)
Re: [rfc] git submodules howto, Uwe , (Mon Sep 24, 3:11 am)
Re: [rfc] git submodules howto, Miklos Vajna, (Mon Sep 24, 4:30 am)
Re: [rfc] git submodules howto, J. Bruce Fields, (Tue Sep 18, 9:29 am)
Re: [rfc] git submodules howto, Miklos Vajna, (Tue Sep 18, 11:47 am)
Re: [rfc] git submodules howto, J. Bruce Fields, (Tue Sep 18, 11:55 am)
Re: [rfc] git submodules howto, Miklos Vajna, (Tue Sep 18, 12:11 pm)
Re: [rfc] git submodules howto, Michael Smith, (Tue Sep 18, 2:12 pm)
[PATCH] User Manual: add a chapter for submodules, Miklos Vajna, (Wed Sep 19, 1:42 pm)
Re: [PATCH] User Manual: add a chapter for submodules, Sven Verdoolaege, (Wed Sep 19, 5:00 pm)
Re: [PATCH] User Manual: add a chapter for submodules, Junio C Hamano, (Wed Sep 19, 3:44 pm)
[PATCH] User Manual: add a chapter for submodules, Miklos Vajna, (Wed Sep 19, 8:34 pm)
Re: [PATCH] User Manual: add a chapter for submodules, Junio C Hamano, (Thu Sep 20, 12:15 am)
Re: [PATCH] User Manual: add a chapter for submodules, Miklos Vajna, (Thu Sep 20, 6:02 pm)
Re: [PATCH] User Manual: add a chapter for submodules, Johannes Schindelin, (Thu Sep 20, 6:34 am)
Re: [PATCH] new test from the submodule chapter of the user ..., Johannes Schindelin, (Thu Sep 20, 2:47 pm)
[PATCH] User Manual: add a chapter for submodules, Miklos Vajna, (Wed Sep 19, 8:01 pm)
Re: [PATCH] User Manual: add a chapter for submodules, J. Bruce Fields, (Wed Sep 19, 4:30 pm)
Re: [rfc] git submodules howto, Michael Smith, (Tue Sep 18, 8:10 am)
Re: [rfc] git submodules howto, Johannes Schindelin, (Tue Sep 18, 8:03 am)
speck-geostationary