Git uses sub-modules to reference external projects
Introduction to Git submodule
This is often the case. When you work on a project, you need to use another project. It may be a third-party library or a library that you develop independently and use in multiple parent projects. In this scenario, the next common problem arises: You want to process two projects separately, but you need to use another one.
The sub-module allows you to treat a Git repository as a subdirectory of another Git repository. This allows you to clone another repository to your project and keep your submission independent.
Add a sub-module for Git sub-module usage
First, you need to clone the external repository to your subdirectory.
Assume that you want to add the pacman project to your blog project.git submodule add
Add an external project as a sub-module:
12 |
Cd bloggit submodule add https://gitcafe.com/aceking/pacman.git themes/pacman |
Now you have a pacan project in the themes/pacman subdirectory of the project. You can go to the subdirectory to make changes, add your own remote writable warehouse to push your changes, pull and merge the changes from the original warehouse, and so on.
. Gitmodules file: This is a configuration file that saves the project URL and the local subdirectory you pulled.
Clone a project with a tape Module
Clone the project that you just created the sub-module. You will get the directory containing the subitem, but there is no file in it: the pacman directory exists, but it is empty.
You must run the following two commands:git submodule init
To initialize your local configuration file,git submodule update
To pull all data from that project and check out the appropriate submissions listed in your upper-level project.
123 |
Cd bloggit submodule init themes/pacamangit submodule update |
Now your pacman sub-directory is in the exact state you submitted previously.
Fedora downloads Git through Http Proxy
Install Git on Ubuntu Server
Create a Git repository on the server (Ubuntu)
Git simple tutorial in Linux (taking Android as an example)
Git authoritative guide PDF
Git 2-minute Guide
Git details: click here
Git: click here
This article permanently updates the link address: