0

My current project/repository repoA depends on a different self-made repository repoB . This repoB contains some very general functions such that I can be used by other projects as well. That is the reason why I put these general functions in a different repository. So after cloning this repoB with git in repoA, my directory setup looks as following,

- repoA
---- repoB

When running the command git status inside ~/repoA, it warns me that I have untracked files which makes sense as I just have cloned this new repository.

My question is: should I add/commit this other repository repoB to repoA What is the best practice with using multiple repositories? My gut feeling says that having the code of repoB existing twice (because it exists inside repoA as well) is unnecessary .

In the case that I do not want to add this repoB to repoA; is .gitignore the way to go therefore?

EDIT: extra context, repoB contains python code representing dynamics and calculating commands for a robot and repoA contains (python) code to create a ROS package

HerChip
  • 113
  • 10
  • 1
    Use a dependency manager for the specific language/domain. Don't try and force git to support that role. – evolutionxbox Mar 10 '22 at 09:40
  • Also for my own custom written “packages”? – HerChip Mar 10 '22 at 10:11
  • Yes. Tools like npm (for JS) specifically support this. – evolutionxbox Mar 10 '22 at 10:14
  • Did you try to use git submodule? https://www.atlassian.com/git/tutorials/git-submodule – Eduardo Silva Mar 10 '22 at 11:59
  • @evolutionxbox thank you for the suggestion; do you have any python specific suggestions? – HerChip Mar 14 '22 at 12:38
  • @EduardoSilva, thank you for the suggestion; I will take a look at it. However, I do think that my problem/question is not so specific that it needs a whole extra software step. Using other repositories in new project happens all the time I would guess? I'm I approaching this problem from a incorrect perspective? – HerChip Mar 14 '22 at 12:40
  • https://stackoverflow.com/questions/20101834/pip-install-from-git-repo-branch you can install packages using pip directly from a git repo – evolutionxbox Mar 14 '22 at 12:53
  • 1
    @HerChip, I think that you are trying share code using different repos, submodules is the best solution. You could try use a clone repo inside you main repo but I thnk is hard to keep is up-to-date. Submodule works exactly way you are looking for. – Eduardo Silva Mar 14 '22 at 14:44
  • @evolutionxbox that are packages from pypi, I'm talking about my own custom packages – HerChip Mar 15 '22 at 10:04
  • 1
    @HerChip the link I gave shows installing a custom package using pip. – evolutionxbox Mar 15 '22 at 13:02

0 Answers0