In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Git submodule". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "how to use Git submodule" together.
Submodule added
Adding submodules is very simple, with the following command:
git submodule add
Where url is the path of the submodule, and path is the directory path stored by the submodule.
After successful execution, git status will see that.gitmodules have been modified in the project and a new file (the path just added) has been added.
git diff --cached View the modified content You can see that submodules have been added, and under the new file is the hash summary of submodule submissions.
git commit commit completes the addition of submodules
Submodule usage
After cloning a project, there is nothing in the default submodule directory. To download the submodule, execute the following command in the root directory of the project:
git submodule initgit submodule update
Or:
git submodule update --init --recursive
After execution, there is a source code under the submodule directory, and then execute the corresponding makefile.
Submodule update
After the maintainer of a submodule commits an update, projects using the submodule must be manually updated to include the latest commit.
In the project, go to the submodule directory, execute git pull update, check git log to see the corresponding commit.
After completion, return to the project directory, you can see the updates to be submitted to the submodule. Use git add to submit.
Submodule deleted
Sometimes the project maintenance address of the submodule changes, or if the submodule needs to be replaced, the original submodule needs to be deleted.
Deleting submodules is more complicated. The steps are as follows:
rm-rf submodule directory delete submodule directory and source code
vi .gitmodules Delete entries for submodules in the.gitmodules file in the project directory
vi .git/config Delete submodule related entries in a configuration item
rm .git/module/* Delete the submodule directory under the module. Each submodule corresponds to a directory. Note that only the corresponding submodule directory can be deleted.
If prompted "already exists in index," do the following:
git rm --cached submodule path
After deleting, submit to the warehouse.
Thank you for reading, the above is the content of "how to use Git submodule", after learning this article, I believe that everyone has a deeper understanding of how to use Git submodule, and the specific use needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.