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

Re: [Q] Branch aliases (synonyms)?

From
HFHallvard Breien Furuseth <h.b.furuseth@usit.uio.no>
Date
Jul 3, 2012, 12:23 UTC
Message-ID
<93cfd6eb9045585728dfe649359a103c@ulrik.uio.no>
In-Reply-To
<1919214.YKUdgul2iY@laclwks004>
 Brian Foster wrote:
Show 16 quoted lines
> (...)
>  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.
 People may have private scripts which will
 be surprised when they encounter B.  E.g. when
 parsing the output from 'git branch'.
 Check out B, then you expect B rather than A
 to be reported as the current branch:
   git checkout B
   git branch
   * A
     B -> A
>   ▶ Are there other solutions?
 You haven't explained the problem which led you to want "equal"
 branches.  E.g. if it's hard to teach developers to switch
 from B to A, a hook which rejects pushes to B might help.
 Possibly in addition to them using a private symref.  In this
 case, 'git symbolic-ref B refs/heads/A' might work better.
 Hallvard
Previous: Brian FosterNext: Hallvard Breien Furuseth
Message 2 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.