Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The <code>git push</code> command requires you to specify a refspec, else you will have to edit <code>.git/config</code> to specify the default action in the case of no refspecs being specified. For example, consider the scenario where you have the branch named <code>master</code>.</p> <p>For pushing the <code>master</code> branch, you will:</p> <pre><code>git push refs/heads/master:refs/heads/master git push master:master git push master </code></pre> <p>All of the above are same. The refspec looking like a path is the most unambiguous way to specify a refspec. That way, you can be sure that you are referring to the branch named <code>master</code> instead of the tag named <code>master</code>.</p> <p>Otherwise, you can edit <code>.git/config</code> and add:</p> <pre><code>[push] default = matching </code></pre> <p>This would allow you to just <code>git push</code>, and Git will push to the remote branch of the local branch you are currently in. For example, if you are currently in branch <code>master</code>, <code>git push</code> will push the local master branch to the remote master branch.</p> <p>As has been stated by janneb, you will have to use a bare repository inorder to push to it without a warning. The issue with pushing to a normal (not bare) repository is that, the primary owner (of the particular `normal' repository) will not be wanting changes added to his/her repository. At that time, if someone pushes to this repository, and deletes a branch (or any other changes), the owner will not have expected such a change. Thus, the warning.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload