Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git best practice for a cross-repository folder (TortoiseGit) [closed]

I'm pretty sure this has been answered before, but I can't find a good one for me. Whats the best way to integrate a repository, which should be up-to-date, in another? This repository should exist in a few other repositories. I've read about

  • subtrees
  • submodules

I tried submodules but for a git newcomer like me, it seams very complicated. In my idea, when I pull the repository, the sub-repo should also update itself. Is there another, easy way I have missed?

Example: The repository Source_Global should be in repository MyFramework as well as in MyGameEngine.

I'm working with TortoiseGit on Windows.

like image 876
Krystex Avatar asked Jul 21 '15 11:07

Krystex


1 Answers

It's been a few years since the last answer, so I think it's worth revisiting this question.

Submodules

This appears to be the most widespread way to handle your situation (at least according to Google Trends). But there are plenty of complaints online about how it's difficult to use. To wit:

  • You have to be careful to keep your submodule state clean and avoid making corrupted commits
  • A repo with a submodule is difficult to clone
  • You can't see submodule commit history in the parent repo

Subtrees

I think the Git implementation for subtrees is much more user-friendly than submodules. Subtrees are affected by none of the three issues I listed above. But TortoiseGit still doesn't support creating, pulling, or pushing subtrees. (You can view and commit to them, though.) You can try Atlassian Sourcetree as a substitute, but that has its own drawbacks.

I think of subtrees as the talented but neglected sibling of submodules.

like image 69
Ilya Avatar answered Oct 08 '22 01:10

Ilya