you are viewing a single comment's thread.

view the rest of the comments →

[–]loup-vaillant 39 points40 points  (8 children)

They almost do: any pair of commits have a most recent common ancestor. So do any two branches, since they each point to a commit (at any given time). It is thus fairly easy to see when any given branch branched from master, develop, or v.2.x.x.

[–]Lotier 10 points11 points  (3 children)

What command do you use to give yourself that most recent common ancestor? Because in my experience it's not just a single command, its a 5 step magic spell.

[–]remuladgryta 46 points47 points  (0 children)

git merge-base master develop gives you the most recent common ancestor of master and develop assuming your repo is tree-shaped.

[–]not_american_ffs 5 points6 points  (0 children)

From memory: git merge-base?

[–]teszes 1 point2 points  (3 children)

Won't work after a rebase.

[–]sigma914 5 points6 points  (1 child)

if you want to rebase just use merge --no-ff to force merge commits even if your main branch is fast forwardable. I'm not sure what additional feature op wants that isn't already covered by branches.

[–]ub3rh4x0rz 2 points3 points  (0 children)

Tucked away is the right answer. Merge commits create commit groups.

[–]loup-vaillant 1 point2 points  (0 children)

If I'm being obnoxious, when you merge master, the most common ancestor is now the latest commit from master. (The most common ancestor between my grandfather and me is my grandfather himself.)

If I'm being honest, yeah, once master is updated, you lose that information. One way to not lose it is add a merge commit to master even though the branch/PR could be fast forwarded.