title: What does GIT PUSH do exactly?
body: <p>I can't seem to find a good explanation of this.</p>
  
  <p>I know what <strong>git pull</strong> does:</p>
  
  <p>1) a <strong>fetch</strong>, i.e. all the extra commits from the server are copied into the local repo and the <em>origin/master</em> branch pointer moves to the end of the commit chain</p>
  
  <p>2) a <strong>merge</strong> of the <em>origin/master</em> branch into the <em>master</em> branch, the <em>master</em> branch pointer moving to the newly created commit, while the <em>origin/master</em> pointer staying put.</p>
  
  <p>I assume <strong>git push</strong> does something very similar, but I don't know for sure. I believe it does one of these, or something similar, or something else (?):</p>
  
  <ul>
  <li>copies all local commits and makes a merge there (the reverse of what <strong>git pull</strong> does); but in this case, the server does not have my local <em>master</em> branch, so I can't see what is it merging</li>
  </ul>
  
  <p>OR</p>
  
  <ul>
  <li>merges my <em>master</em> branch into the <em>origin/master</em>, pushing the resulting commit to the server and linking it next to the existing end-commit, also moving the server's <em>master</em>; this doesn't seem right because then my local <em>origin/master</em> is not in sync with the server's.</li>
  </ul>
  
  <p>I'm currently using git for basic operations so I'm doing fine, but I want to fully understand these internals.</p>