Git update submodules recursively

git submodule update –recursive You will also probably want to use the –init option which will make it initialize any uninitialized submodules: git submodule update –init –recursive Note: in some older versions of Git, if you use the –init option, already-initialized submodules may not be updated. In that case, you should also run the command … Read more

How do I revert my changes to a git submodule?

A more fail-safe method than all previous answers: git submodule deinit -f . git submodule update –init The first command completely “unbinds” all submodules, the second then makes a fresh checkout of them. It takes longer than the other methods, but will work whatever the state of your submodules.

Git: track branch in submodule but commit in other submodule (possibly nested)

Update 2020: The OP BartBog reports in the comments: The current (2016) answer does not work that well (anymore?) with subsubmodules since $top/.gitmodules does not contain the branch info of the subsub (and subsubsub modules) New solution: export top=$(pwd) git submodule foreach ‘b=$(git config -f ${top}/.gitmodules submodule.${path}.branch); \ case “${b}” in \ “”) git checkout … Read more

How to handle a transitive dependency conflict using Git submodules and CMake?

There are several approaches for detect and discard inclusion of the project, which has already be included in some other parts of the main project. Check project’s target existence The simplest pattern for single inclusion of subproject is checking existence of some subproject’s target: # When include ‘C’ subproject if(NOT TARGET library_C) add_subdirectory(C) endif() (Here … Read more

How can I get a git submodule’s associated commit ID from a past commit in the parent clone?

You may use git-ls-tree to see what the SHA-1 id of a given path was during a given commit: $ git ls-tree released-1.2.3 foo 160000 commit c0f065504bb0e8cfa2b107e975bb9dc5a34b0398 foo (My first thought was git show released-1.2.3 foo, but that fails with “fatal: bad object”.) Since you are scripting the output, you will probably want to get … Read more

Is there a way to use a Mercurial repository as Git submodule?

Using git-hg. First, make sure there is a (non-Mercurial) git submodule under your main repository. If you don’t have other submodules yet, just create a dummy submodule for some library other than core-plot, for instance: main-repo $ git submodule add https://repo.url.com/repo.git repo Second, clone the core-plot library into some directory. main-repo $ git-hg clone https://code.google.com/p/core-plot/ … Read more

Git submodule URL not including username?

If I understand correctly, you’re using HTTP basic authentication over HTTPS to allow only particular developers to access the repository. In that case, you can commit a .gitmodules that looks like: [submodule foo] path = sub/foo url = https://example.com/git/foo.git … i.e. without a user name, and then tell each developer to put their username and … Read more

tech