oreoui.blogg.se

Git add remote submodule
Git add remote submodule














#GIT ADD REMOTE SUBMODULE UPDATE#

In order to update an existing Git submodule, you need to execute the “git submodule update” with the “–remote” and the “–merge” option. In some cases, you are not pulling a Git submodule but you are simply look to update your existing Git submodule in the project. The submodule is always set to have its HEAD detached at a given commit by default : as the main repository is not tracking the changes of the submodule, it is only seen as a specific commit from the submodule repository. Submodule path 'vendors': checked out '43d08138766b3592352c9d4cbeea9c9948537359'Īs you can see, pulling a Git submodule in our colleague Git repository detached the HEAD at a given commit. Submodule 'vendors' () registered for path 'vendors'Ĭloning into '/home/colleague/submodules/vendors'. To update its own Git configuration, it has to execute the “git submodule update” command.

git add remote submodule

In its Git repository, our colleague first starts by cloning the repository, however, it is not cloning the content of the Git submodule.

git add remote submodule

Going back to the example we described before : let’s pretend that we are in a complete new Git repository created by our colleague. To pull a Git submodule, use the “git submodule update” command with the “–init” and the “–recursive” options. If you don’t execute this command, you will fetch the submodule folder, but you won’t have any content in it. Whenever you are cloning a Git repository having submodules, you need to execute an extra command in order for the submodules to be pulled. In this section, we are going to see how you can pull a Git submodule as another developer on the project. The submodule you just added are marked as changes to be committed in your repository.git/config) was also modified in order to include the submodule you just added gitmodules” is created in your Git repository : this file contains the references to the remote repositories that you cloned as submodules A folder is created in your Git repository named after the submodule that you chose to add (in this case “vendors”).When adding a new Git submodule into your project, multiple actions will be performed for you :

git add remote submodule git add remote submodule

Remote: Total 5257 (delta 0), reused 0 (delta 0), pack-reused 5257 To add “project” as a submodule, you would run the following command at the root of your repository $ git submodule add vendorsĬloning into '/home/user/main/project'. $ git commit -m "Added the submodule to the project."Īs an example, let’s pretend that you want to add the “project” repository as a submodule on your project into a folder named “vendors”. As a consequence, you will need to commit your submodule by using the “git commit” command. When adding a Git submodule, your submodule will be staged. Optionally, you can also specify the target directory (it will be included in a directory named as the remote repository name if not provided) $ git submodule add In order to add a Git submodule, use the “git submodule add” command and specify the URL of the Git remote repository to be included as a submodule. The first thing you want to do is to add a Git submodule to your main project.

  • Configuring submodules for your repository.













  • Git add remote submodule