git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Finding a branch point in git
@ 2012-05-27 12:37 Felipe Contreras
  2012-05-28  6:20 ` Jeff King
  0 siblings, 1 reply; 13+ messages in thread
From: Felipe Contreras @ 2012-05-27 12:37 UTC (permalink / raw)
  To: git

Hi,

When discussing git vs. mercurial, and what can mercurial do that git
can't, I inevitably see somebody mention that mercurial branches can
be used to find the branch point (the point at which a branch started;
even if it's a long-lived one that has been merged to 'master'
multiple times).

There have been a few solutions in stackoverflow[1], but none that
work in all cases.

But I think I've found an ad-hoc one that uses the commit messages to
find the first merge of a branch, and then the merge-base.

For reference, if somebody is interested:

---
[alias]
    branch-point = !sh -c 'merge=$(git rev-list --min-parents=2
--grep="Merge.*$1" --all | tail -1) && git merge-base $merge^1
$merge^2'
---

Cheers.

[1] http://stackoverflow.com/questions/1527234/finding-a-branch-point-with-git/

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-06-01  9:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 12:37 Finding a branch point in git Felipe Contreras
2012-05-28  6:20 ` Jeff King
2012-05-28 12:36   ` Felipe Contreras
2012-05-28 19:06     ` Jeff King
2012-05-30 17:07       ` Felipe Contreras
2012-05-30 21:54         ` Jeff King
2012-05-31 15:27           ` Felipe Contreras
2012-05-31 16:10             ` Felipe Contreras
2012-05-31 20:37             ` PJ Weisberg
2012-06-01  9:15               ` Felipe Contreras
2012-05-31 15:37           ` Martin Langhoff
2012-05-30 16:52   ` Felipe Contreras
2012-05-30 21:45     ` Jeff King

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).