title: Find the REMOTE parent branch of a LOCAL git branch
body: <p><strong>How do I get the name of the remote <code>git</code> branch from which the local <code>git</code> current commit was branched-off?</strong>  </p>
  
  <p>I assume this is a 4 step process, and that the first three steps might be as follows:  </p>
  
  <p><hr><strong>Step One: Get the name of the current branch in the local git repo:</strong><hr>  </p>
  
  <pre><code>git rev-parse --abbrev-ref HEAD    
  </code></pre>
  
  <p><hr><strong>Step Two: Get the hash of the currently checked out commit from the local repo:</strong><hr>  </p>
  
  <pre><code>git rev-parse HEAD          # full hash  
  </code></pre>
  
  <p><hr><strong>Step Three: Get the name of the upstream tracking branch on the remote git repo:</strong><hr>  </p>
  
  <pre><code>git rev-parse --abbrev-ref @{upstream}
  </code></pre>
  
  <p><hr><strong>Step Four: Get the name of the parent upstream tracking branch on the remote git repo:</strong><hr>  </p>
  
  <p>What specific code is required to do this?  After reading @ChrisJohnsen's answer to <a href="https://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-git-branch">this other posting</a>, I imagine that the solution involves looking for the most recent commit that was derived from another branch in the remote repository.  However, the code in the answers to the linked posting all seem to be designed for local repositories.  <strong>This current question is different because I am asking how to find the remote repository parent branch from a local repository child branch.</strong>  </p>
  
  <p>I am adding the <code>bash</code> tag because these commands are running on CentOS servers that can use <code>bash</code> scripting.  </p>