![]() ![]() ![]() Suppose my submodule name is then run the below command like git submodule deinit -f - rishimodule To delete a submodule one can use the below commands. The -remote helps to update the existing repository without pulling it. The below command $ git submodule update -remote -merge So you can update the previous submodule in the project. In some cases you dont want to pull a submodule. If the whole command is not used the folder will be pulled but not the content. So we can see the working on the same project as in previous example. Submodule 'asign' () registered for path 'assign'Ĭloning into '/home/parth/submodules/assign'. THe below example shows how it works $ git submodule update -init -recursive To pull a submodule with its content you the below command $ git submodule update -init -recursive Working as a developer sometimes you need to pull a submodule on another project. This is usually common when you work on several checked out branches and you want to roll back to the commit tracked by parent repository. The parent repository tracks all the commits.Ī submodule update checks out the revision of all the commits that the parent repository has gone through after a pull.This is useful when you want to roll back to the current commit of the parent repository. There is always an option to use the best commit. So the above example shows adding a project submodule in my project in a folder named assign. Remote: Total 3025 (delta 0), reused 0 (delta 0), pack-reused 5257 Password for into '/home/rishivant/main/project'. git submodule add assignĬloning into '/home/rishivant/Documents/ut it assignment/assign'. This example will show you in a better way. The command to commit it is :- $ git commit -m "Added the submodule to the project." So as a consequence you will need to commit it. While adding your submodule you will find that it will be staged. To add a submodule use ‘git submodule add’ and specify the url of the repository you want to add as a submodule. 2-How to create repository with submodules ?Ģ.1 To add a submodule in a git repository. gitmodules file which contains the path of all submodules and the link to clone them. You can find the submodule anywhere inside the parents repository working directory.We can configure the submodule via. Now this helps in tracking the changes in all the repositories from a central repository. In simple words git allows you to include other repositories into a single repository called parent repository. Sub modules provide the feature of embedding one repository into another as a sub folder. Reading Time: 3 minutes 1 – What is a Git Submodule?Īctually git provides the feature of git submodule to help projects with this. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |