Skip to contentSkip to conversation

tracking a file from another project in my own project

DISCUSSION picca 4 participants 6 messages Jun 15, 2016

lore
Share & tools
lore

picca

author
#0 lore raw

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.

#1 lore raw
Quoted 2 lines · picca

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".

author
#2 lore raw
Quoted 3 lines · On Tue, 22 Jan 2008 01:20:41 -0800 Junio C Hamano <[email protected]> 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 ?

Quoted 1 line

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

#3 lore raw
Quoted 8 lines · picca
Quoted 3 lines · On Tue, 22 Jan 2008 01:20:41 -0800 Junio C Hamano <[email protected]> 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.

Quoted 3 lines

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.

Quoted 4 lines
Quoted 1 line

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.

Signature · 3 lines
Jakub Narebski
Poland
ShadeHawk on #git
#4 lore raw
Quoted 2 lines · Jakub Narebski
Quoted 1 line · picca

Junio C Hamano <[email protected]> wrote:

[...]

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

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.

#5 lore raw
Quoted 16 lines · Sergei Organov
Quoted 2 lines · Jakub Narebski
Quoted 1 line · picca

Junio C Hamano <[email protected]> wrote:

[...]

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

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.

Quoted 4 lines

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

Signature · 2 lines
Jakub Narebski
Poland