On Sat, Feb 02, 2008 at 12:25:27PM -0700, Michael L Torrie wrote:
> Replying to my own post here...  Actually with git I can organize it
> like this, right:
> 
> - lots of independent projects
> - one git supermodule that includes them all as submodules
> - clone my backup git repository from this supermodule which will pull
> in the subs automatically.
> 
> Correct?

Yep.

> What happens if I move the physical location of a submodule to another
> folder?  Do I have to redo the submodule in the "master" repository?
> When pulling over, say ssh, can the git supermodule pull the
> submodules automatically?  Sorry for the potentially dumb questions.

A supermodule has a checked-in file called .gitmodules that specifies
each of the submodules and their urls.  If you need to change where a
submodule is, just change the url in the .gitmodules file and check it
in.

The git-submodule init command does the following (quote from the man
page):

"Initialize the submodules, i.e. register in .git/config each submodule
name and url found in .gitmodules. The key used in .git/config is
submodule.$name.url. This command does not alter existing information in
.git/config."

So it looks like if you change a url, any old clones will have to be
manually updated to the new url, but any new clones will automatically
get the new url.

The git-submodule update command clones missing submodules and checks
out the version specified in the supermodule.

In your backup situation, you'll want to make sure that you don't forget
to make commits in the supermodule as the submodules are modified.  The
supermodule doesn't automatically grab the newest commits in the
submodule.  This is the correct behavior in general (if my project needs
version 1.6 of libxyz, I wouldn't want it to pull in version 1.7 unless
I asked it to).  You could easily write a script that goes into the
supermodule, does a "git pull" in each subdirectory/submodule, and then
does a "git commit" in the supermodule.

I hope that makes sense.

-- 
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868

Attachment: pgp9bEInI233b.pgp
Description: PGP signature

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to