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

[RFC PATCH 0/3] Support for tail (branch point) experiment

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Mar 10, 2023, 21:45 UTC
Message-ID
<20230310214515.39154-1-felipe.contreras@gmail.com>

This is *not* meant a serious proposal, it's just an exploration of an idea.

The topic of finding the actual point a branch started to fork has been discussed for decades [1] and yet no clear solution is in sight. That's why this idea I had in 2013 keeps coming back.

The idea is simple: add the concept of a branch tail (e.g. `master@{tail}`.

The motivation is that Git's main competitor--Mercurial--does have the ability to tell with 100% accuracy where a branch started, Git does not.

Many hacks have been proposed, such as parsing the commit messages for "Merge branch", using the reflog, adding options like --exclude-first-parent-only. All these clever solutions fail in one way or another.

If we stopped trying to be clever we could go for the easy solution: simply add a tail marker.

This has many advantages:
 * `git rebase` can simply use that
 * `git send-email` can use that
 * `git range-diff` can use that
 * `git name-rev` will now be accurate

I know most of my tools (`git send-seriels`, `git related`, and `git smart-list`) would greatly benefit from this information.

Moreover, for one the most important commands of git, it makes much more sense semantically:

    git rebase --onto branch@{upstream} branch@{tail} branch
Than the current:
    git rebase --onto something branch@{upstream} branch

I'm not expecting this to be seriously considered (given the track record of my proposals), but now the idea is on the record, so it can be referenced in future discussions (which are likely not going to just stop).

Cheers.
[1] https://stackoverflow.com/questions/1527234/finding-a-branch-point-with-git/71193866#71193866
Felipe Contreras (3):
  branch: add new 'tail' concept
  sha1-name: add @{tail} helpers
  rebase: update branch tail after rebasing
 branch.c                  | 12 ++++++++++++
 branch.h                  |  1 +
 builtin/clone.c           |  1 +
 builtin/rebase.c          | 15 +++++++++++++++
 object-name.c             | 30 +++++++++++++++++++++++++++++-
 t/t1514-rev-parse-tail.sh | 39 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100755 t/t1514-rev-parse-tail.sh
-- 
2.40.0.rc2.1.gf652911b76.dirty
Next: Felipe Contreras
Message 1 of 6 in “Support for tail (branch point) experiment”
  1. 0/3 Support for tail (branch point) experimentFelipe Contreras, Mar 10, 2023
  2. 1/3 branch: add new 'tail' conceptFelipe Contreras, Mar 10, 2023
  3. 2/3 sha1-name: add @{tail} helpersFelipe Contreras, Mar 10, 2023
  4. 3/3 rebase: update branch tail after rebasingFelipe Contreras, Mar 10, 2023
  5. Junio C HamanoMar 11, 2023
  6. Felipe ContrerasMar 11, 2023

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.