{"thread":{"id":"13312","subject":"git submodules.","startedAt":"2008-04-28T19:50:20Z","lastAt":"2008-04-28T21:01:39Z","messageCount":2,"participants":["Victor Bogado da Silva Lins","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"75442","messageId":"1209412220.29267.22.camel@omicron.ep.petrobras.com.br","threadId":"13312","inReplyTo":null,"subject":"git submodules.","fromName":"Victor Bogado da Silva Lins","fromEmail":"victor@bogado.net","sentAt":"2008-04-28T19:50:20Z","receivedAt":"2008-04-28T19:50:20Z","isPatch":false,"sender":{"key":"victor@bogado.net","avatar":"https://gravatar.com/avatar/4ad1d046d4c1a5673a65aac199e2113f4e2d2ffe88d095cb3e17c1f20126cfac?d=mp&s=160"},"body":"Is there any documentation about how those work?\n\nWhat I need is this, I have a already existing git repository, that have\na subdir that could be seen as submodule (by this I mean that he is\nrelated, but could have a different commit tree). The git repository\nalready exists and has many commits that apply to either the submodule\nor the main module (I would say that there is no commit that touch\nboth). So is it possible to separate them easily? Would it keep my older\ncommits? \n\nbellow is a shell script that samples my setup: \n\n=========================== cut here =================================\n#!/bin/bash\n\ngitdir=git_submodules_dir\n\nif [[ -d $gitdir ]]; then \n\trm -rf $gitdir;\nfi\n\nmkdir $gitdir\n\ncd $gitdir\n\ngit init\n\necho \"testing 1 2 3\" > file_a.txt\ngit add file_a.txt\ngit commit -m \"initial setup\"\n\nmkdir submodule\n\necho \"submodule file\" > submodule/file_b.txt\ngit add submodule/file_b.txt\ngit commit -m \"submodule file\"\n\necho \"updated main file\" >> file_a.txt\ngit commit -a -m \"updated file in main module\"\n\necho \"updated sumodule file\" >> submodule/file_b.txt\ngit commit -a -m \"updated file in the submodule\"\n=========================== cut here =================================\n"},{"id":"75454","messageId":"20080428210139.GH26880@genesis.frugalware.org","threadId":"13312","inReplyTo":"1209412220.29267.22.camel@omicron.ep.petrobras.com.br","subject":"Re: git submodules.","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-04-28T21:01:39Z","receivedAt":"2008-04-28T21:01:39Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Mon, Apr 28, 2008 at 04:50:20PM -0300, Victor Bogado da Silva Lins <victor@bogado.net> wrote:\n> Is there any documentation about how those work?\n\nYes. There is a chapter in the user manual and there is the\ngit-submodule manpage.\n\n> What I need is this, I have a already existing git repository, that have\n> a subdir that could be seen as submodule (by this I mean that he is\n> related, but could have a different commit tree). The git repository\n> already exists and has many commits that apply to either the submodule\n> or the main module (I would say that there is no commit that touch\n> both). So is it possible to separate them easily?\n\nYes, see git-filter-branch.\n\n> Would it keep my older commits? \n\nNot really, git-filter-branch will rewrite history, so the commit hashes\nwill change. Of course no code will be lost, but after such a migration,\npeople will not be able to easily just pull.\n"}]}