I have a local git repository a “central” repo at github. I’m working on a part of a project, while a friend is working on a related piece that is in an entirely separate repo, is it possible for me to simply link directly to my friend’s repo?
For example, the app is called widgets. I have all my code in widgets/app/mycode and my friend is writing code that goes into widgets/plugins/awesome/hiscode.
I want to be able to always have http://github.com/mycode/widgets/plugins/hiscode to be a direct link or clone to http://github.com/hiscode/awesome?
It could be possible I’m missing something basic in my question or knowledge of git, if so please ask, and I’ll be happy to try to fill in the blanks.
I am deploying to my production site via capistrano, so maybe a script of some kind may be easier?? I don’t know (that’s why I’m posting)!!
As mentioned in git submodules, true nature, this is possible by declaring in
widgets/plugins/awesome/hiscodea submodule referring tohttp://github.com/hiscode/awesome.You can then regularly pull from that submodule his latest changes in order to update it, provided you then commit again from the
widgets/directory (which is your “main” project, that is the project which contains the submodule).That way your main project will record the new SHA1 of the updated submodules.
You can even directly develop in that submodule, pushing directly to
http://github.com/mycode/widgets/plugins/hiscode(while still committing widget, again to record the new SHA1).But you need to remember to checkout a branch first within that submodule, because a “submodule update” always initialize/update it as a detached head.