Inside a main repo, there is another repo (which might have been downloaded from github, i.e.), I call this a sub-repo.
I don't want to use git submodules feature.
The sub-repo might be commited and pushed to his own remote eventually. But I would like to carry on work in the main repo, ignoring that folder (sub-repo) actually is a git repo. But I would like to track the sub-repo content from the main-repo (I was studying the consequences here).
I was successful in this endeavor until the point where I pushed main-repo commits, when I noticed the sub-repo content wasn't pushed together. Even though I added it when committing.
Using git ls-files, I see the folder (sub-repo) is there, but files aren't listed, so I'm not sure the sub-repo content is acctualy being tracked by main-repo.
Using git ls-tree --full-tree -r HEAD, I see the sub-repo being called a commit, instead of a blob as is the case for other files of the main-repo.
Is it possible to push the sub-repo content together?
I tried and files in sub-repo can be pushed together with main-repo. The following steps can be refered:
git clone <URL for sub-repo> to clone the sub-repo under main-repogit status, you will find a untracked folder sub-repo, then use git add sub-repo/ and git commit to track/main-repo/sub-repo directorygit add sub-repo/new.txt and git commit (note: it’s run in the /main-repo directory) git push to push to remote main-repo, and you can find the file new.txt also there. Also you can use git ls-files to find the fileNote: You may have noticed that the mode is 160000 if we use git add sub-repo and git commit, and mode is 100644 if we use git add sub-repo/ and git commit. 1600000 is Gitlink, it means you record a commit as a directory entry rather than a subdirectory or a file, somewhat like submodules. 100644 means regular non-executable file. So you can treat sub-repo as a folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With