git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: "Antoine Beaupré" <anarcat@debian.org>,
	"Phillip Wood" <phillip.wood@dunelm.org.uk>,
	"Felipe Contreras" <felipe.contreras@gmail.com>
Subject: [RFC PATCH 0/3] Support for tail (branch point) experiment
Date: Fri, 10 Mar 2023 15:45:12 -0600	[thread overview]
Message-ID: <20230310214515.39154-1-felipe.contreras@gmail.com> (raw)

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


             reply	other threads:[~2023-03-10 21:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 21:45 Felipe Contreras [this message]
2023-03-10 21:45 ` [RFC PATCH 1/3] branch: add new 'tail' concept Felipe Contreras
2023-03-10 21:45 ` [RFC PATCH 2/3] sha1-name: add @{tail} helpers Felipe Contreras
2023-03-10 21:45 ` [RFC PATCH 3/3] rebase: update branch tail after rebasing Felipe Contreras
2023-03-11  0:04 ` [RFC PATCH 0/3] Support for tail (branch point) experiment Junio C Hamano
2023-03-11  3:26   ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230310214515.39154-1-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=anarcat@debian.org \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).