Reputation: 1911
I have repository A which has "normal behavior".
In that repo I have a readme.md
, About.md
, some folders with other files etc.
What I want know is to add separate folder for my homeassistant automation which I'm running on Raspberry Pi (this will be repository B).
I successfully added on local, and connected with my github through console from my Pi, but it wont let me do a "push" command as expected because, I didn't do "pull", but those files I really don't need on my Pi, it will mess up my configuration.
I would like to have structure like
Project (Repository A)
- Readme.md
- Folder1
- SomeFile.txt
- RepositoryB Folder (in this folder will be pushed form my Pi files and config)
Should I just use a fork on repositoryB which will be a separate repo?
Upvotes: 1
Views: 127
Reputation: 261
You could include repository B as a submodule in repository A via git submodule add https://github.com/<name-of-repo-B>
. With this approach, you can independently push/pull changes to repository A and repository B.
When cloning a repository that has submodules included you must execute git submodule update --init --recursive
afterward to clone the submodules.
Be aware that using pull on repository A would not update repository B when having B included as a submodule. To update B as well, you can run git submodule update --remote --recursive
in repository A or git pull
in repository B (git submodule update --remote vs git pull).
See https://git-scm.com/book/en/v2/Git-Tools-Submodules
It also seems you can only clone a subdirectory of a Git repository as of Git 2.19 (How do I clone a subdirectory only of a Git repository?)
Upvotes: 1