Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There was almost the <a href="http://groups.google.com/group/github/browse_thread/thread/eb3046a7b4c8bec7/b64ee724a0db5471" rel="noreferrer">same question on GitHub</a> a year ago.</p> <p>The idea was to rename the master branch:</p> <pre><code>git branch -m master development git branch -m published master git push -f origin master </code></pre> <blockquote> <p>Making master have what you want people to use, and do all other work in branches. </p> </blockquote> <p>(a "<code>git-symbolic-ref HEAD refs/head/published</code>" would not be propagated to the remote repo)</p> <p>This is similar to "<a href="https://superuser.com/a/749412/141">How do I delete origin/master in Git</a>".</p> <hr> <p>As said in <a href="http://www.nabble.com/0.0-branch-in-eAthena-renamed-to-master-td20799674.html" rel="noreferrer">this thread</a>: (emphasis mine)</p> <blockquote> <p>"<code>git clone</code>" creates only a single local branch.<br> To do that, it looks at the <code>HEAD ref</code> of the remote repo, and creates a local branch with the same name as the remote branch referenced by it.</p> <p>So to wrap that up, you have repo A and clone it:</p> <ul> <li><p><code>HEAD</code> references <code>refs/heads/master</code> and that exists<br> -> you get a local branch called master, starting from origin/master</p></li> <li><p>HEAD references <code>refs/heads/anotherBranch</code> and that exists<br> -> you get a local branch called <code>anotherBranch</code>, starting from <code>origin/anotherBranch</code></p></li> <li><p>HEAD references <code>refs/heads/master</code> and that doesn't exist<br> -> "git clone" complains</p></li> </ul> <p><strong>Not sure if there's any way to directly modify the <code>HEAD</code> ref in a repo</strong>.</p> </blockquote> <p>(which is the all point of your question, I know ;) )</p> <hr> <p><em>Maybe</em> the only way would be a <a href="http://michael-prokop.at/blog/2007/09/11/git-server-for-the-poor-git-update-server-info-rsync-and-remote-repository/" rel="noreferrer">"publication for the poor"</a>, where you:</p> <pre><code> $ git-symbolic-ref HEAD refs/head/published $ git-update-server-info $ rsync -az .git/* server:/local_path_to/git/myRepo.git/ </code></pre> <p>But that would involve write access to the server, which is not always possible.</p> <hr> <p>As I explain in "<a href="https://stackoverflow.com/a/3302018/6309">Git: Correct way to change Active Branch in a bare repository?</a>", <a href="http://git-scm.com/docs/git-remote" rel="noreferrer"><code>git remote set-head</code></a> wouldn't change anything on the remote repo.</p> <p>It would only change the remote tracking branch stored locally in your local repo, in <code>remotes/&lt;name&gt;/HEAD</code>.</p>
    singulars
    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