git-pull-everything, including submodules

If you have a submodule inside your git repo, it’s often handy to just pull all the changes from remote, including your actual git repo, but also all your submodules. If you are on git 1.7.3 or later, you can just add a ~/.gitconfig alias like the following:

[alias]
    pullall = !git pull --recurse-submodules && git submodule update --recursive

The 2nd command (git submodule update) is needed to actually check out the new commits (the ones your master repository points to) in the submodules.

Example:

$ git pullall
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 13 (delta 7), reused 0 (delta 0)
Unpacking objects: 100% (13/13), done.
From gitcube:/home/git/pchess
   9f19a46..915ba55  master     -> origin/master
Fetching submodule server/libs/erlyweb
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From github.com:ettore/erlyweb
   a319f79..6e0ac0c  master     -> origin/master
Updating 9f19a46..915ba55
Fast-forward
 server/bin/pchess_rollout.sh              | 13 +++++++++----
 server/libs/erlyweb                       |  2 +-
 server/pchesslauncher.erl                 |  5 ++---
 /snip/
 8 files changed, 47 insertions(+), 192 deletions(-)
 delete mode 100644 server/pchess/rsrc/apn_dev.pem
 delete mode 100644 server/pchess/rsrc/rsrc.contents.txt
 delete mode 100644 server/pchess/rsrc/yaws_out.log
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s