This is a configuration file that stores the mapping between the project’s URL and the local subdirectory you’ve pulled it into: $ cat. If you run git status right after you add the submodule, you see two things: $ git statusįirst you notice the. You can go into that subdirectory, make changes, add your own writable remote repository to push your changes into, fetch and merge from the original repository, and more. Now you have the Rack project under a subdirectory named rack within your project. Initialized empty Git repository in /opt/subtest/rack/.git/ You add external projects as submodules with the git submodule add command: $ git submodule add git:///chneukirchen/rack.git rack The first thing you should do is clone the external repository into your subdirectory. Suppose you want to add the Rack library (a Ruby web server gateway interface) to your project, possibly maintain your own changes to it, but continue to merge in upstream changes. This lets you clone another repository into your project and keep your commits separate. Submodules allow you to keep a Git repository as a subdirectory of another Git repository. Git addresses this issue using submodules. The issue with vendoring the code into your own project is that any custom changes you make are difficult to merge when upstream changes become available. The issue with including the library is that it’s difficult to customize the library in any way and often more difficult to deploy it, because you need to make sure every client has that library available. You’re likely to have to either include this code from a shared library like a CPAN install or Ruby gem, or copy the source code into your own project tree. Instead of writing your own Atom-generating code, you decide to use a library. Suppose you’re developing a web site and creating Atom feeds. A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other. Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects. It often happens that while working on one project, you need to use another project from within it.
0 Comments
Leave a Reply. |