title: git: pushing with remote reference in refspecs
body: <p>could somebody explain me (or lead me to a good reference) the following issue?</p>
  
  <p>I know that below is the correct push command that I have to use:</p>
  
  <pre><code>git push origin refs/heads/master:refs/heads/master
  
     (I also know that it has short forms, like:
          git push origin master:master
          or
          git push origin master)
  </code></pre>
  
  <p>However, once time, I did 2 following push (by mistake):</p>
  
  <pre><code>  (1) git push origin refs/heads/master:refs/remotes/heads/master
  
    (2) git push origin refs/heads/master:refs/remotes/origin/master
  </code></pre>
  
  <p>git report no error in both commands, although in (1), I have no remote name "heads".</p>
  
  <ul>
  <li><p>My first question is: what does git push to the remote repository in these cases? Do they harm my remote repository?</p></li>
  <li><p>The second question is: according to <a href="http://progit.org/book/ch9-3.html" rel="nofollow">http://progit.org/book/ch9-3.html</a> everything under "refs/remotes" is remote references
  which are to know the last commit ID on the corresponding remote branch at the last server comminication. Is it just for that
  (e.g. only for information), does any git command use these references?</p></li>
  </ul>
  
  <p><strong>Update with my findings about the command (2)</strong> </p>
  
  <p>I carefully verified again the behavior of the command (2) by:</p>
  
  <ul>
  <li>backup the remote repository</li>
  <li>do the (2)</li>
  <li>compare the two repositories (the current one and the backup)</li>
  </ul>
  
  <p>I found differences in the current one (the one effected by command (2))</p>
  
  <ul>
  <li>in "objects" folder, there are 2 new files created: one is .pack file and the other is .idx file</li>
  <li>in "refs" folder, a new refs was create "remotes/origins/master"</li>
  </ul>
  
  <p>I noticed that the output of command (2) was</p>
  
  <pre><code>Counting objects: 842, done.
  Compressing objects: 100% (337/337), done.
  Writing objects: 100% (651/651), 336.30 KiB, done.
  Total 651 (delta 243), reused 612 (delta 218)
  To file:///data/resto/central-repo
   * [new branch]      master -&gt; origin/master
  </code></pre>
  
  <p>Now I made another test:</p>
  
  <ul>
  <li>Clone the remote repo into 2 local repos</li>
  <li>In one local repo, I made change on a file, commit, push (git push origin master)</li>
  <li><p>In the other local repo</p>
  
  <ul>
  <li>I made change on a file, commit</li>
  <li><p>Push with
    git push origin master:master</p>
  
  <p>I got an error message from git: <code>"...! [rejected]        master -&gt; master (non-fast-forward)..."</code> That what I expect</p></li>
  <li><p>Then I made a push with command (2) and the result was what I mention ealier above.</p></li>
  </ul></li>
  </ul>
  
  <p>So it's obviously the (2) is different from git push origin master.</p>
  
  <p>What is the meaning of "refs" folder <code>in the remote</code> repository? The command (2) create a new "refs" in
  the remote repositoty, what does it refer to?</p>