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?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

If I do a commit in repo1, how will I be able to pull the update into the submodule?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.