Git and Git Subrepo #22875
-
Hi, I am newbie to Git and starting to learn it. I have been using SVN for quite a long time. I want to simulate following.
I added a few files to subrepo ‘srepo’ locally and want to push to upstream subrepo. when I execute command ‘git subrepo add FileName.txt’ then it gives me error git-subrepo: ‘add’ is not a command. See ‘git subrepo help’. When I execute command ’ git subrepo commit’ it gives me following message:- git-subrepo: Command ‘commit’ requires arg ‘subdir’. This command requires that the upstream HEAD be in the The After adding subdir name with commit command it says “git-subrepo: Can’t commit: ‘subrepo/origin’ doesn’t contain upstream HEAD.” Please let me know how fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The main repo in folder If you don’t want to have that extra formalism of the submodule, then I would recommend just treating I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Hey, https://github.com/ingydotnet/git-subrepo is a thing, and it’s not (really) submodules. It’s also tricky to figure out how to use. Starting out: Daily usage: git subrepo pull # see |
Beta Was this translation helpful? Give feedback.
The main repo in folder
main
would be a standard repository. The foldermain/srepo
would be what Git calls a submodule. But because submodule working trees within a superproject are tied to a specific commit, you wouldn’t typically develop directly withinmain/srepo
but you would have asrepo
project somewhere else that you would develop in and then update the commit thatmain
has to that known-good version.If you don’t want to have that extra formalism of the submodule, then I would recommend just treating
main/srepo
as a component that you work on logically separately but isn’t phyisically separated. You could do this by having just one Git repository and working on separate branches t…