Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As I explain in <a href="https://stackoverflow.com/questions/18112966/how-to-delete-purge-remove-all-history-commits-references-branches-from-a-remote/18113182#18113182">this answer</a> to <a href="https://stackoverflow.com/q/18112966/456814">Delete or remove all history, commits, and branches from a remote Git repo?</a>, you can also achieve the same thing as <a href="https://stackoverflow.com/questions/5363857/clean-out-remote-git-repo-delete-all-files-but-not-the-repo-itself/5363971#5363971">Ceilingfish's answer</a> (i.e. delete all references/branches/tags in the remote repo) by doing the following:</p> <ol> <li><p>Create new empty repo with initial commit:</p> <pre><code>mkdir new cd new echo "This is the README" &gt; README.md git init git add . git commit -m "Add README.md (initial commit)" </code></pre></li> <li><p>Add remote repo as origin:</p> <pre><code>git remote add origin &lt;url-to-remote&gt; </code></pre></li> <li><p>Mirror push to remote:</p> <pre><code>git push origin --mirror </code></pre></li> </ol> <p>That will <strong><em>delete all references/branches/tags in your remote repo</em></strong>, and any dangling commits will probably be garbage collected eventually. From the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="noreferrer">official Linux Kernel Git documentation for <code>git push</code></a> (emphasis mine):</p> <blockquote> <pre><code>--mirror </code></pre> <p>Instead of naming each ref to push, specifies that all refs under <code>refs/</code> (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>.</p> </blockquote>
 

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