From: Jeff King Date: Mon, 03 Aug 2020 19:40:06 GMT Subject: Re: Renaming the "master" branch without breaking existing clones Message-ID: <20200803194006.GA2715275@coredump.intra.peff.net> In-Reply-To: <20200803160051.GA50799@syl.lan> On Mon, Aug 03, 2020 at 12:00:51PM -0400, Taylor Blau wrote: > This is more-or-less what I was proposing in the message that I linked > above. Maybe a more solidified proposal might look something as follows: > > - We could introduce a mechanism to mark certain refs as aliases to > other refs. For example, a remote might publish its > 'refs/heads/master' as an alias to 'refs/heads/main', so that any > reads or writes to the former get applied to the latter > transparently. I think symrefs do this already. Try this: git init parent git -C parent checkout -b main git -C parent commit --allow-empty -m one git -C parent symbolic-ref refs/heads/master refs/heads/main git clone parent clone cd clone GIT_TRACE_PACKET=1 git ls-remote 2>&1 >/dev/null | perl -lne '/git - A ref alias can be annotated to say "I am a transition ref alias", > i.e., that clients should be taught to rename their copy of 'master' > to 'main' (and update remote-tracking refs accordingly). It's not specifically marked as a transition, but a client could act on the symref advertisement above. -Peff