git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Q] Branch aliases (synonyms)?

From
Johan Herland <johan@herland.net>
Date
Jul 3, 2012, 16:22 UTC
Message-ID
<CALKQrgeAXLSwsqwTe_FZN0aNHwnoSBHBt+PO9jpCtzRM1Aeyrw@mail.gmail.com>
In-Reply-To
<4261222.bYBuBBxnOa@laclwks004>
On Tue, Jul 3, 2012 at 3:40 PM, Brian Foster <brian.foster@maxim-ic.com> wrote:
Show 30 quoted lines
> On Tuesday 03-July-2012 05:23:29 Hallvard Breien Furuseth wrote:
>> Brian Foster wrote:
>> > (...)
>> >  The catch is a desire(? requirement?) that, when the
>> >  transition ends, people used to using B can continue
>> >  to use B, people used to using A can continue to use A,
>> >  and there is no difference.  That is, after the end of
>> >  transition, branch names A and B are the same thing.
>> >  Always.  Automatically.
>> >
>> >  Using a symref seems a working answer.  That is,
>> >  after the merge, change B from a true branch head
>> >  into a symref pointing to A:
>> >
>> >       git merge ...
>> >       git symbolic-ref refs/heads/B refs/heads/A
>> >
>> >   ▶ What are the gotchas?
>>
>>  Git clone will turn symref B into a regular branch,
>>  which will not move in parallel with A.
>
>  Yes, I realize that (and my test script shows it).
>  But I'm not concerned about it  — albeit I've yet
>  to check with my colleagues —  because it matters
>  only if you _expect_ the two to be identical in
>  clones at all times.  That wasn't the requirement.
>  The (and I must say I _do_ think this is silly!)
>  requirement is “People used to using A can still
>  use A.  People used to using B can still use B.”

FWIW, we have done a similar thing at $dayjob: A git repo (originally converted form Subversion) still used "trunk" as the main development branch. We wanted to start following Git conventions, so we renamed it to "master", and set up "trunk" as a symref to "master". We then told all the other developers that "trunk" is now "master", and that they should switch at their own leisure. After a grace period, we will remove the "trunk" symref.

AFAICS, this seems to work very well. People in old clones keep working on "trunk" for as long as they like. They push their work back to "trunk" on the server, which follows/preserves the symref, and updates the "master" branch. People in new clones get the "master" branch automatically, and push their work directly back to the server's "master". Obviously, all clones also get the other branch when they fetch from the server, but so far nobody has gotten confused by this other branch that "mysteriously" follows their "main" branch.

Have fun! :)
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Brian FosterNext: Hallvard Breien Furuseth
Message 8 of 11 in “[Q] Branch aliases (synonyms)?”
  1. Brian FosterJul 3, 2012
  2. Hallvard Breien FurusethJul 3, 2012
  3. Hallvard Breien FurusethJul 3, 2012
  4. Brian FosterJul 3, 2012
  5. Michael HaggertyJul 3, 2012
  6. Brian FosterJul 4, 2012
  7. Brian FosterJul 5, 2012
  8. Johan HerlandJul 3, 2012
  9. Hallvard Breien FurusethJul 3, 2012
  10. Brian FosterJul 4, 2012
  11. Hallvard Breien FurusethJul 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.