Posts

Showing posts from September, 2023

git submodules

 git submodules allows to link one or more related git projects, which allows to build and execute commands in the dependent projects in a seamless way both on development machines and CI servers. This post explains about some basic commands required with git repositories containing git submodules. Add a new submodule: git submodule add <git_repo_url> <submodule_path> git add . git commit -m "Added Submodule" git push Remove an existing submodule: git submodule deinit <submodule_path> git rm <submodule_path> rm -rf .git/modules/<submodule_path> git add . git commit -m "Removed Submodule" git push Pull changes to submodules in already cloned repository: git pull --recurse-submodules git submodule update --init --recursive Pull changes to submodules in parallel: The -j parameters specifies the maximum number of parallel jobs to pull the submodules. In the below example -j8 means, up to 8 submodules will be pulled in parallel. The will spe