0

1. The situtation
Let's say I have a repository with the following folder structure:

repo1\
|
|-Foo\
|-Bar\


2. The Requests
- In a second repo repo2 I want to use repo1 as submodule; but only the contents of the folder Foo\.
- Whenever someone clones repo2 and initializes the submodule, automatically (or only with reasonable effort) there should be only the folder Foo\ present in the submodule folder.

3. What I have tried
- Sparse checkout as indicated here does not work with submodules at all, at least as far as I managed to make it work
- Filter branch as indicated here or here works for me fine; but whenever someone clones repo2 the procedure must be repeated for their clone

4. The Questions
- How can I make that work?
- What else should I try?

Benjamin Zach
  • 1,452
  • 2
  • 18
  • 38

1 Answers1

1
  1. Convert repo1/foo into separate independent repository
  2. Add this repo as submodule to repo1|repo2

You'll have some headache on intersection of a "split point" for any direction, but... it's fair price for possibility to use now as you want

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110