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

Re: Merging submodules (was Re: Feature suggestion: git-hist)

From
H.Merijn Brand <h.m.brand@xs4all.nl>
Date
Jul 30, 2008, 16:26 UTC
Message-ID
<20080730182648.393cfccc@pc09.procura.nl>
In-Reply-To
<FA2D570A-B2B1-4994-AA6A-9C0C55E69900@silverinsanity.com>

On Wed, 30 Jul 2008 11:15:55 -0400, Brian Gernhardt <benji@silverinsanity.com> wrote:

Show 29 quoted lines
> 
> On Jul 30, 2008, at 9:58 AM, H.Merijn Brand wrote:
> 
> > One (very) big disadvantage of  SCCS  is that commits are on a per- 
> > file
> > basis, and only in a single directory. This drawback still haunts me  
> > in
> > git, as my first attempts to convert were successful in a single  
> > folder
> > and git cannot merge folders into a single project.
> >
> > Say I now have
> >
> > /work/src/project/.git
> > /work/src/project/module_a/.git
> > /work/src/project/module_b/.git
> > /work/src/project/module_c/.git
> >
> > Which are all converted repos from SCCS, I'd like to merge the three
> > module_# repos into the top level repo.
> 
> Following the example of Linus, the following is completely untested.
> 
> First you fetch all of the heads/tags/etc into the superproject with  
> commands like
> 
> git fetch module_a refs/heads/*:refs/remotes/module_a/*
> git fetch module_b refs/heads/*:refs/remotes/module_b/*
> git fetch module_c refs/heads/*:refs/remotes/module_c/*
All went well
 
Show 5 quoted lines
> Then you do something like:
> 
> rm -rf module_{a,b,c}/.git # Do this in a test repository, obviously...
> git add module_a module_b module_c
> git commit # Needed because '-s ours' uses current HEAD, not index
So far so good.
> git merge --no-commit -s ours module_a/master module_b/master module_c/master

$ git merge --no-commit -s ours fnc/master i00f000/master i99f000/master include/master l00m000/master l01f000/master l02f000/master l03f000/master l06f000/master l90z000/master leerpl/master mutbev/master prtabel/master rpt/master tabellen/master zoomen/master Automatic merge went well; stopped before committing as requested

> git commit --amend

$ git commit --amend fatal: You are in the middle of a merge -- cannot amend. $ git status # On branch master nothing to commit (working directory clean)

When I start git-gui, it still shows a long commit message: Merge commit 'fnc/master'; commit 'i00f000/master'; commit 'i99f000/master'; commit 'include/master'; commit 'l00m000/master'; commit 'l01f000/master'; commit 'l02f000/master'; commit 'l03f000/master'; commit 'l06f000/master'; commit 'l90z000/master'; commit 'leerpl/master'; commit 'mutbev/master'; commit 'prtabel/master'; commit 'rpt/master'; commit 'tabellen/master'; commit 'zoomen/master'

All other areas are clear
Show 7 quoted lines
> From this point on, the project repository has a merged history of  
> the sub-projects, and if anyone doesn't catch up and still makes a  
> commit on a subproject you can use "git merge -s subtree" to merge it  
> in anyway.
> 
> You may need to "git rm --cached" some files after the "git add" step  
> if your .gitignore files aren't perfect.
-- 
H.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/
Previous: H.Merijn Brand
Message 13 of 13 in “Feature suggestion: git-hist”
  1. H.Merijn BrandJul 30, 2008
  2. Pieter de BieJul 30, 2008
  3. H.Merijn BrandJul 30, 2008
  4. Lars NoschinskiJul 30, 2008
  5. H.Merijn BrandJul 30, 2008
  6. Miklos VajnaJul 30, 2008
  7. H.Merijn BrandJul 30, 2008
  8. Santi BéjarJul 30, 2008
  9. Avery PennarunJul 30, 2008
  10. Lars NoschinskiJul 30, 2008
  11. Santi BéjarJul 30, 2008
  12. H.Merijn BrandJul 30, 2008
  13. H.Merijn BrandJul 30, 2008

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.