title: Understanding git submodule and "freezing" it at a specific commit hash or version
body: <p>Assuming the following project layout:-</p>
  
  <pre><code>mainrepo_git
      |____ .git
      |____ .gitmodules
      |____ proj            &lt;------- directory containing the code files for mainrepo
              |____ 3rdpartysourcecode &lt;-- directory containing upstream open source code
              |      |____ .git
              |      |____ 3rdpartyfiles
              |
              |____ mainrepofilesanddirectories  
  </code></pre>
  
  <p><strong>mainrepo_git</strong> contains source code I am directly responsible for.  I have read/write access and can push and pull directly to a remote git repository which I manage.</p>
  
  <p>Nested inside <strong>mainrepo_git</strong> is a directory which I named <strong>3rdpartysourcecode</strong>.  This <strong>3rdpartysourcecode</strong> directory is in fact another git repo (also commonly referred to as a "git submodule") which is pointing to an open source 3rd party git repository managed by other developers. I only have read access to it. No write access.</p>
  
  <p>Is there any way of 'freezing' a specific commit hash of the git submodule in relation to a commit made in my main repository?</p>
  
  <p>For example, if I am at (or I revert to) commit <em>a12ucak</em> in my mainrepo, my git submodule also gets reverted to a specific version which I tie to commit <em>a12ucak</em>?  And when I switch to commit <em>b349jdsak</em>, my git submodule also gets reverted to a version which I tie to <em>b349jdsak</em>?</p>
  
  <p><strong>So my question is:</strong> there is a way to create a linkage between a specific commit in the main repo with a corresponding commit in the git submodule? In such a way where when I checkout that specific commit in the main git repo, the corresponding commit in the git submodule will also be checkout.</p>