Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You might want to try pushing an empty local repo with the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-push.html"><code>--mirror</code> flag</a> (emphasis mine):</p> <blockquote> <pre><code>--mirror </code></pre> <p>Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to <code>refs/heads/</code>, <code>refs/remotes/</code>, and <code>refs/tags/</code>) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and <strong><em>deleted refs will be removed from the remote end</em></strong>. This is the default if the configuration option <code>remote.&lt;remote&gt;.mirror</code> is set.</p> </blockquote> <p>If your repo is on GitHub, you'll get this error if <code>master</code> is set to the default branch when trying to push:</p> <pre><code>$ mkdir practice; cd practice; $ git init; git remote add origin git@github.com:user/practice.git; $ git push origin --mirror remote: error: refusing to delete the current branch: refs/heads/master To git@github.com:user/practice.git ! [remote rejected] master (deletion of the current branch prohibited) error: failed to push some refs to 'git@github.com:user/practice.git' </code></pre> <p>I got around this by making an initial commit, then pushing.</p> <p><strong>Obligatory Warning</strong>: this will, of course, completely wipe out all of your history and commits in your remote repo&mdash;all references, all branches, all tags, etc. Make sure this is actually what you want to do. Of course, you can always make a backup clone of your remote repo before doing this, in case you want to keep it around for whatever reason.</p> <p>Also note that none of the commits will actually be deleted right away. They'll just become <em>dangling</em> commits, meaning that they're not reachable from a branch. Eventually they'll get garbage collected by Git repos, but if you have access to your remote repo, you can manually start the garbage collection with <code>git gc</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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