# .git inside a .git: is it safe?

4 messages from 2007-03-12 to 2007-03-14. Participants: Guilhem Bonnefille, Shawn O. Pearce, Jakub Narebski.
Thread: https://gitlist.dev/t/7218

## Guilhem Bonnefille, 2007-03-12 21:56

Subject: .git inside a .git: is it safe?
Message-ID: <8b65902a0703121456s56008088ra14452ef7f325cf3@mail.gmail.com>
URL: https://gitlist.dev/e/8b65902a0703121456s56008088ra14452ef7f325cf3%40mail.gmail.com

```
Hi,

I'm actually working on the packaging of a project. To do so, I use
two Git repositories:
- one to follow the main project
- one to manage my updates on this project.

But, the matter is I cannot merge the both root. I need to have the
main project sources in a subdirectory of my own project. My workspace
is as follow: myproject/sub/tree/mainproject

With SVN, I think such things are handled with svn:external.

Actually, with Git, I frequently copy the mainproject inside its
subtree in my workspace.


But, I recently discover that everything seems fine if I include the
Git repo of mainproject inside the Git repo of my project. The layout
lloks like this:
myproject
|- .git
|- sub
  |- tree
    |- mainproject
      |- .git


It seems to work. But do you think such layout is "safe" ?

-- 
Guilhem BONNEFILLE
-=- #UIN: 15146515 JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com
-=- mailto:guilhem.bonnefille@gmail.com
-=- http://nathguil.free.fr/

```

## Shawn O. Pearce, 2007-03-12 22:15

Subject: Re: .git inside a .git: is it safe?
Message-ID: <20070312221540.GA16545@spearce.org>
URL: https://gitlist.dev/e/20070312221540.GA16545%40spearce.org
In-Reply-To: <8b65902a0703121456s56008088ra14452ef7f325cf3@mail.gmail.com>

```
Guilhem Bonnefille <guilhem.bonnefille@gmail.com> wrote:
> But, I recently discover that everything seems fine if I include the
> Git repo of mainproject inside the Git repo of my project. The layout
> lloks like this:
> myproject
> |- .git
> |- sub
>  |- tree
>    |- mainproject
>      |- .git
> 
> 
> It seems to work. But do you think such layout is "safe" ?

Yes, that's fine.  You just probably want an entry in the top level
project (myproject) that says ignore the stuff under mainproject.
That way "git add ." in myproject doesn't include files in
mainproject by accident.

-- 
Shawn.

```

## Jakub Narebski, 2007-03-12 22:56

Subject: Re: .git inside a .git: is it safe?
Message-ID: <et4lmo$nnj$1@sea.gmane.org>
URL: https://gitlist.dev/e/et4lmo%24nnj%241%40sea.gmane.org
In-Reply-To: <8b65902a0703121456s56008088ra14452ef7f325cf3@mail.gmail.com>

```
Guilhem Bonnefille wrote:

> Hi,
> 
> I'm actually working on the packaging of a project. To do so, I use
> two Git repositories:
> - one to follow the main project
> - one to manage my updates on this project.
> 
> But, the matter is I cannot merge the both root. I need to have the
> main project sources in a subdirectory of my own project. My workspace
> is as follow: myproject/sub/tree/mainproject
> 
> With SVN, I think such things are handled with svn:external.
> 
> Actually, with Git, I frequently copy the mainproject inside its
> subtree in my workspace.
> 
> 
> But, I recently discover that everything seems fine if I include the
> Git repo of mainproject inside the Git repo of my project. The layout
> lloks like this:
> myproject
> |- .git
> |- sub
>   |- tree
>     |- mainproject
>       |- .git
> 
> 
> It seems to work. But do you think such layout is "safe" ?

IIRC Junio uses similar layout managing todo branch in git.git
(which comes from separate repository).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Guilhem Bonnefille, 2007-03-14 15:02

Subject: Re: .git inside a .git: is it safe?
Message-ID: <8b65902a0703140802t4d98bbfdj84e8c4523e852e8a@mail.gmail.com>
URL: https://gitlist.dev/e/8b65902a0703140802t4d98bbfdj84e8c4523e852e8a%40mail.gmail.com
In-Reply-To: <20070312221540.GA16545@spearce.org>

```
Thanks for your answers. It's really a cool feature for my needs.

On 3/12/07, Shawn O. Pearce <spearce@spearce.org> wrote:
> Yes, that's fine.  You just probably want an entry in the top level
> project (myproject) that says ignore the stuff under mainproject.
> That way "git add ." in myproject doesn't include files in
> mainproject by accident.

In fact, in my case, I think I will prefer to store the mainproject's
sources in both Git repo. By this way, I will be able to easily found
the version of mainproject's sources that are compatible with the rest
of myproject.

-- 
Guilhem BONNEFILLE
-=- #UIN: 15146515 JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com
-=- mailto:guilhem.bonnefille@gmail.com
-=- http://nathguil.free.fr/

```
