git: change origin of cloned submodule

This apparently is very much dependent on the version of git you are using. If present, change the url entry in the [submodule “<dirname>”] section of the .gitmodules file. If present, change the url entry in the [submodule “<dirname>”] section of the .git/config file. Change the url in the configuration of the submodule itself. The … Read more

`–name` option doesn’t work with `git submodule add` command

Don’t conflate the path and the name of a submodule. You want to run git submodule add [email protected]:ironsand/cookbook-foo.git foo/ instead. For more details, see the git-submodule man page; the relevant git-submodule syntax here is git submodule [–name <name>] <repository> [<path>] where… <repository> is the URL of the new submodule’s origin repository. <path>, if specified, determines … Read more

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: 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

git submodule sync command – what is it for?

Git stores information about submodules in two places. The first is in a file called .gitmodules, which is checked in to the git repository. Changes to this file are what get propagated to other repositories. The other location is in .git/config, and it’s where git actually looks when performing most commands. So imagine you’ve worked … Read more