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

Git diff says subproject is dirty

Update Jan. 2021, ten years later: “git diff“(man) showed a submodule working tree with untracked cruft as Submodule commit <objectname>-dirty, but a natural expectation is that the “-dirty” indicator would align with “git describe –dirty“(man), which does not consider having untracked files in the working tree as source of dirtiness. The inconsistency has been fixed … Read more

Rewrite history git filter-branch create / split into submodules / subprojects

I resolved my own question, here is the solution: git-submodule-split library another_library Script git-submodule-split: #!/bin/bash set -eu if [ $# -eq 0 ] then echo “Usage: $0 submodules-to-split” fi export _tmp=$(mktemp -d) export _libs=”$@” for i in $_libs do mkdir -p $_tmp/$i done git filter-branch –commit-filter ‘ function gitCommit() { git add -A if [ … Read more

How to convert a Git repo to a submodule, which is nested in another (parent) Git repo?

Change to the main directory, checkout the master branch, and do the following Git command to create a new submodule for plugin1: git submodule add (url_to_plugin1_repository) subdirectory1/plugin1sm Here the “url_to_plugin1_repository” points to your current Git repository for plugin1. A new directory will be created call subdirectory1/plugin1sm, which will track your remote repository. I have given … Read more

Highly coupled git submodules

A few notes for anyone else happening across this! The biggest mistake rookies are going to make is committing with detached HEAD in the submodule, after having done a submodule update. I’m going to try to counter this with strong warnings from hooks. The next biggest will probably be failing to do a submodule update … Read more

Duplicate submodules with Git

This isn’t built into git, but you can definitely do it with symlinks like you say. You might want to have a look at git new-workdir (from git’s contrib directory), which does essentially this. It’s not aware of anything to do with submodules, but a submodule doesn’t know it’s a submodule – it’s the parent … Read more

Git commit to common submodule (master branch)

Short answer: cd ProjectFooBarCommoneSubmodule git checkout master <Do your editing> git commit –all -m “Lots of fixes” git push submodule_origin master cd .. git add ProjectFooBarCommoneSubmodule git commit -m “Bumped up the revision of ProjectFooBarCommoneSubmodule” git push origin master The longer one: Git submodules are a dependency mechanism, where the main project (say A) defines … Read more