Re: git bug: Including a git repository in a directory
- From
René Scharfe <l.s.r@web.de>
- Date
- Jun 6, 2022, 11:00 UTC
- Message-ID
- <24022c08-ed58-8157-6036-6a4c6a49f195@web.de>
- In-Reply-To
- <e308be58-a399-8e5c-36a8-96d3d58caff3@sprangle.com>
Am 06.06.22 um 07:43 schrieb Steven Jonn Edlefsen:
Show 17 quoted lines
> Git cannot commit/push a directory with a git repository in > a sub-directory. > > The sub-directory with the git repository and the directories below > are set to the “master” branch, while the directories above remain > set to the new branch. > > When the top directory is committed, the sub-directory with the > git repository appears as an empty file. > > Even when the subdirectory branch name is changed from master > to the new branch and the top directory is re-commited/pushed, > the same problem occurs. > > When the git repository in the sub-directory is removed, e.g. > the .git file is removed, and top directory is committed/pushed, > the subdirectory has all the sub-directories and files.
This is intended behavior. A repository inside another one needs special handling. Git provides the submodule feature for that. A simpler alternative for some use cases is called subtree.
That's all I can tell you, as I haven't used submodules and subtrees myself. At least I hope these keywords help you explore your options. Others will probably chime in with advise on which one to use if you explain _why_ you want to combine multiple repositories.
René