# tracking a file from another project in my own project

6 messages from 2008-01-22 to 2008-01-22. Participants: picca, Junio C Hamano, Jakub Narebski, Sergei Organov.
Thread: https://gitlist.dev/t/11702

## picca, 2008-01-22 08:35

Subject: tracking a file from another project in my own project
Message-ID: <20080122093546.72db8da0@synchrotron-soleil.Fr>
URL: https://gitlist.dev/e/20080122093546.72db8da0%40synchrotron-soleil.Fr

```
Hello

Supposed I want to use the strbuf.c and strbuf.h file of git.git in my
own project.git. Is it possible to configure git to track this
particular files when I do a git pull?

This way all strbug bugs corrected in git.git will be apply
automatically to my own project.

Thank you.

```

## Junio C Hamano, 2008-01-22 09:20

Subject: Re: tracking a file from another project in my own project
Message-ID: <7v7ii2rzbq.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v7ii2rzbq.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080122093546.72db8da0@synchrotron-soleil.Fr>

```
picca <picca@synchrotron-soleil.Fr> writes:

> This way all strbug bugs corrected in git.git will be apply
> automatically to my own project.

If I were you I'd probably just keep git.git as a submodule in
your project and have two symlinks from your toplevel pointing
at git.git/strbuf.[ch] (or from src/ to ../git.git/strbuf.[ch]).

Or "merge -s subtree".

```

## picca, 2008-01-22 13:56

Subject: Re: tracking a file from another project in my own project
Message-ID: <20080122145658.18b6ef89@synchrotron-soleil.Fr>
URL: https://gitlist.dev/e/20080122145658.18b6ef89%40synchrotron-soleil.Fr
In-Reply-To: <7v7ii2rzbq.fsf@gitster.siamese.dyndns.org>

```
On Tue, 22 Jan 2008 01:20:41 -0800
Junio C Hamano <gitster@pobox.com> wrote:

> If I were you I'd probably just keep git.git as a submodule in
> your project and have two symlinks from your toplevel pointing
> at git.git/strbuf.[ch] (or from src/ to ../git.git/strbuf.[ch]).

So submodule is a requirement to achieved this comportment ?

If someone want to clone my project.git, must he also clone the
git.git project or he loose the ability to follow by it's own the
strbuf.[ch] file ?

> Or "merge -s subtree".

I red the git help merge -s explanation but I do not understand how
it can help in my case.

Thanks

Frederic

```

## Jakub Narebski, 2008-01-22 15:23

Subject: Re: tracking a file from another project in my own project
Message-ID: <m3fxwplw1i.fsf@roke.D-201>
URL: https://gitlist.dev/e/m3fxwplw1i.fsf%40roke.D-201
In-Reply-To: <20080122145658.18b6ef89@synchrotron-soleil.Fr>

```
picca <picca@synchrotron-soleil.Fr> writes:

> On Tue, 22 Jan 2008 01:20:41 -0800
> Junio C Hamano <gitster@pobox.com> wrote:
> 
> > If I were you I'd probably just keep git.git as a submodule in
> > your project and have two symlinks from your toplevel pointing
> > at git.git/strbuf.[ch] (or from src/ to ../git.git/strbuf.[ch]).
> 
> So submodule is a requirement to achieved this comportment ?

If you want to have strbuf.[ch] automatically tracked from git.git
the you would have to have git.git project somehow embedded in your
repository.  Using submodules is one solution.

Currently there is no way to do "sparse checkout", i.e. automatically
checkout only needed files (even if git.git clone has all the
objects), but feel free to implement it... ;-) (just kidding).

Or you can try to convince strbuf authors to make it into separate
project, which would be fetched into git.git like gitk was.  And you
could then pull from this project directly or indirectly (submodule)
into your project.
  
> If someone want to clone my project.git, must he also clone the
> git.git project or he loose the ability to follow by it's own the
> strbuf.[ch] file ?

True.

> > Or "merge -s subtree".
> 
> I read the git help merge -s explanation but I do not understand how
> it can help in my case.

Using subtree merge strategy you can join histories of your project
and git.git, embedding git.git as a subdirectory like gitk and git-gui
are now in git.git.  It is an alternative to using submodules.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Sergei Organov, 2008-01-22 17:30

Subject: Re: tracking a file from another project in my own project
Message-ID: <877ii17opo.fsf@osv.gnss.ru>
URL: https://gitlist.dev/e/877ii17opo.fsf%40osv.gnss.ru
In-Reply-To: <m3fxwplw1i.fsf@roke.D-201>

```
Jakub Narebski <jnareb@gmail.com> writes:
> picca <picca@synchrotron-soleil.Fr> writes:
>> Junio C Hamano <gitster@pobox.com> wrote:

[...]

>> > Or "merge -s subtree".
>> 
>> I read the git help merge -s explanation but I do not understand how
>> it can help in my case.
>
> Using subtree merge strategy you can join histories of your project
> and git.git, embedding git.git as a subdirectory like gitk and git-gui
> are now in git.git.  It is an alternative to using submodules.

Is subtree merge strategy documented?

$ grep subtree Documentation/merge-strategies.txt
$

-- Sergei.

```

## Jakub Narebski, 2008-01-22 18:34

Subject: Re: tracking a file from another project in my own project
Message-ID: <200801221934.43767.jnareb@gmail.com>
URL: https://gitlist.dev/e/200801221934.43767.jnareb%40gmail.com
In-Reply-To: <877ii17opo.fsf@osv.gnss.ru>

```
Sergei Organov wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>> picca <picca@synchrotron-soleil.Fr> writes:
>>> Junio C Hamano <gitster@pobox.com> wrote:
> 
> [...]
> 
>>>> Or "merge -s subtree".
>>> 
>>> I read the git help merge -s explanation but I do not understand how
>>> it can help in my case.
>>
>> Using subtree merge strategy you can join histories of your project
>> and git.git, embedding git.git as a subdirectory like gitk and
>> git-gui are now in git.git.  It is an alternative to using
>> submodules. 
> 
> Is subtree merge strategy documented?
> 
> $ grep subtree Documentation/merge-strategies.txt
> $

Documentation/howto/using-merge-subtree.txt

But I agree that it should be also described, or at least mentioned
in Documentation/merge-strategies.txt
-- 
Jakub Narebski
Poland

```
