While taking new experience with using Git and manage projects with it, I wanted to save a lil time on updating submodules of project by using scribu solution (Easier way to update submodules in git), but it didn’t worked for me (perhaps because of different OS or Git version?!)… after quick research of “GitHub Help guide” we have got corrected working version;)
1. Normally we updating submodules with that sequence of commands:
cd framework git checkout master git pull cd .. git submodule update --init --recursive |
2. So lets create “All in One” command (alias):
git config --global alias.up-sub '!f() { cd $1 && git checkout master && git pull && cd .. && git submodule update --init --recursive; }; f' |
3. Now we can easily use “up-sub” command to update submodules;)
git up-sub framework |
P.S. In above examples “framework” its a name of submodule
[ALT] Alternatively You can open ~/.gitconfig (WIN # C:\Users\xxx\.gitconfig) in text editor, and add at the end of file:
[alias] up-sub = "!f() { cd $1 && git checkout master && git pull && cd .. && git submodule update --init --recursive; }; f" |
P.S.2 All credits goes to scribu
I figured out why it didn’t work for you. `git alias` is a command from git-extras.
Updated the article to use regular git config.