Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The closest thing to renaming is deleting and then re-creating on the remote. For example:</p> <pre class="lang-bash prettyprint-override"><code>git branch -m master master-old git push remote :master # delete master git push remote master-old # create master-old on remote git checkout -b master some-ref # create a new local master git push remote master # create master on remote </code></pre> <p>However this has a lot of caveats. First, no existing checkouts will know about the rename - git does <em>not</em> attempt to track branch renames. If the new <code>master</code> doesn't exist yet, git pull will error out. If the new <code>master</code> has been created. the pull will attempt to merge <code>master</code> and <code>master-old</code>. So it's generally a bad idea unless you have the cooperation of everyone who has checked out the repository previously.</p> <p>Note: Newer versions of git will not allow you to delete the master branch remotely by default. You can override this by setting the <code>receive.denyDeleteCurrent</code> configuration value to <code>warn</code> or <code>ignore</code> on the <em>remote</em> repository. Otherwise, if you're ready to create a new master right away, skip the <code>git push remote :master</code> step, and pass <code>--force</code> to the <code>git push remote master</code> step. Note that if you're not able to change the remote's configuration, you won't be able to completely delete the master branch!</p> <p>This caveat only applies to the current branch (usually the <code>master</code> branch); any other branch can be deleted and recreated as above.</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