title: How to properly update a git submodule?
body: <p>I know this question has been beaten to death. But I still don't have a clear understanding of why my submodule is trying to refer to a commit in my superproject. I have a project which has a number of submodules, some of which reference github repositories which I want to contribute to. After updating the module, I pull the changes of the module:</p>
  
  <pre>
  [ashinn@puppet1 puppet]$ cd modules/ganglia
  [ashinn@puppet1 ganglia]$ git branch
  * (no branch)
    master
  [ashinn@puppet1 ganglia]$ git pull origin master
  remote: Counting objects: 8, done.
  remote: Compressing objects: 100% (4/4), done.
  remote: Total 6 (delta 4), reused 4 (delta 2)
  Unpacking objects: 100% (6/6), done.
  From https://github.com/andyshinn/puppet-ganglia
   * branch            master     -> FETCH_HEAD
  Merge made by recursive.
   README |    1 +
   1 files changed, 1 insertions(+), 0 deletions(-)
  </pre>
  
  <p>Now I want to update the reference to the module in the superproject:</p>
  
  <pre>
  [ashinn@puppet1 ganglia]$ cd ../..
  [ashinn@puppet1 puppet]$ git add modules/ganglia
  [ashinn@puppet1 puppet]$ git commit -m 'updated ganglia module'
  [ganglia c172591] updated ganglia module
   1 files changed, 1 insertions(+), 1 deletions(-)
  </pre>
  
  <p>I am currently working on the ganglia branch, so I push it to my origin (which is 2 differen't URLs):</p>
  
  <pre>
  [ashinn@puppet1 puppet]$ git push origin ganglia
  Counting objects: 8, done.
  Delta compression using up to 2 threads.
  Compressing objects: 100% (6/6), done.
  Writing objects: 100% (6/6), 616 bytes, done.
  Total 6 (delta 4), reused 0 (delta 0)
  To git@github.com:andyshinn/puppet.git
     1876698..c172591  ganglia -> ganglia
  Counting objects: 5, done.
  Delta compression using up to 2 threads.
  Compressing objects: 100% (3/3), done.
  Writing objects: 100% (3/3), 323 bytes, done.
  Total 3 (delta 2), reused 0 (delta 0)
  remote: From /var/lib/puppet/repo
  remote:    dcd1fcc..c172591  ganglia    -> origin/ganglia
  remote: From https://github.com/andyshinn/puppet-ganglia
  remote:    a0c4e21..975c92f  master     -> origin/master
  remote: fatal: reference is not a tree: c5defdeae006c7b87058cc5c79aef60087b63a6b
  remote: Unable to checkout 'c5defdeae006c7b87058cc5c79aef60087b63a6b' in submodule path 'modules/ganglia'
  remote: Updating existing environment ganglia
  To puppet@puppet.mydomain.com:repo
     dcd1fcc..c172591  ganglia -> ganglia
  </pre>
  
  <p>The remote has a post-receive script to checkout branches in different folders and run <code>git submodule update --init</code> for each. If I manually connect to the origin repo I can verify the issue:</p>
  
  <pre>
  -bash-4.1$ git pull
  Already up-to-date.
  -bash-4.1$ git submodule update --init
  fatal: reference is not a tree: c5defdeae006c7b87058cc5c79aef60087b63a6b
  Unable to checkout 'c5defdeae006c7b87058cc5c79aef60087b63a6b' in submodule path 'modules/ganglia'
  </pre>
  
  <p>What am I doing wrong here?</p>