Our Data Science robot intern

Machine learning practitioners know how overwhelming the number of possibilities that we have when building a model can be. It’s like going to a restaurant and having a menu the size of a book and we…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




8.5 Using Git Submodules to Track External Repositories

Pragmatic Version Control — Pragmatic Programmers (64 / 103)

👈 8.4 Tracking Multiple Projects | TOC | Chapter 9 Beyond the Basics 👉

Sometimes you need to track multiple repositories as if they’re all in the same repository. This might be because of a dependency on some third-party library or possibly because your in-house project has been divided into multiple projects to help make them more manageable.

Git allows you to track external repositories through what it calls submodules. These allow you to store a repository within another repository while keeping the two histories completely independent. Those coming from a Subversion background might recognize these as svn:externals.

Let’s demonstrate this behavior. First we need to create a new repository that will house our submodule repository. Let’s create a repository called magic:

With this empty repository initialized, you can use git submodule to view the submodules associated with this repository:

Since there are no submodules defined yet, it doesn’t return anything. Adding a new submodule is straightforward. You use the git submodule add command. It has two required parameters. The first is the repository; the second is the path where you want to store the repository.

For example, let’s add the hocus repository—a small repository hosted on GitHub that I created to use for the book. And to keep things clear, let’s put it in the hocus directory. You can use the command on one line without the \; those are here to make the command fit on the page:

Now when you rerun git submodule, hocus is displayed:

Add a comment

Related posts:

Does cannabis truly influence memory? This is what research as of now says

As authorities investigate cannabis and the impact that it has on human wellbeing, they’re starting to all the more likely comprehend the impact it has on the human cerebrum — and whether cannabis…

Chapter 2 Getting Real with JUnit

The Pragmatic Programmers classic is back! Freshly updated for modern software development, Pragmatic Unit Testing in Java 8 With JUnit teaches you how to write and run easily maintained unit tests in JUnit with confidence. You'll learn mnemonics to help you know what tests to write, how to remember all the boundary conditions,

Best EasyWP hosting alternative in 2021

There are hundreds of Hosting companies are available in which Bluehost is the Best Alternative to EasyWP hosting and and also it is officially recomended by WordPress. In this article I have written…