How to pull a new submodule

When you want to pull a specific new module, you can use the following command: git submodule update –init local/path/to/submodule/folder If you wish to initialize all new submodules however. you can omit the path to the folder like so: git submodule update –init

Git Submodule update over https

Edit your .gitmodules file to use the HTTPS URL. Run git submodule sync to reflect the change to your .git/config file. Run the update command again. Commit and push the changes in your .gitmodules file. Example .gitmodules file: [submodule “vendor/engines/fat_free_crm”] path = vendor/engines/fat_free_crm url = https://github.com/fatfreecrm/fat_free_crm.git Credits: https://stackoverflow.com/a/6632693/1273077

Editing a git submodule

You don’t need a seperate clone. The sub-module folder is a world of its own. Just edit, commit, branch, and push to your heart’s delight. Git is great that way. 🙂 BTW, the parent repository will even detect when changes happen inside the sub-module folder and offer you to commit the current state of the … Read more

git: list of all changed files including those in submodules

Update 2017: as I mentioned in “see diff of commit on submodule in gitlab”, Git 2.11 (Nov. 2016) introduces git diff –submodule=diff Git 2.14 (Q3 2017) will improve that by recursing into nested submodules. See commit 5a52214 (04 May 2017) by Stefan Beller (stefanbeller). (Merged by Junio C Hamano — gitster — in commit a531ecf, … Read more

Swap git submodule with own fork

The submodules are stored in .gitmodules: $ cat .gitmodules [submodule “ext/google-maps”] path = ext/google-maps url = git://git.naquadah.org/google-maps.git If you edit the url with a text editor, you need to run the following: $ git submodule sync This updates .git/config which contains a copy of this submodule list (you could also just edit the relevant [submodule] … 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