0

I'm looking for the easiest way to compare the commit from which a branch was branched from to the current head of that branch. Obviously if I know where I branched off from, I can just compare from that commit to the branch. But it's an annoyance to find that first common parent. Is there an easier way to diff all the changes that were made in a branch since its creation?

A related issue is that if the branch has had merges, it may well be impossible to comprehensibly compare that branch with its root. But what I really want to do is see the results of all the commits directly to that branch (checking each commit one by one can be confusing due to things getting later undone).

Kat
  • 4,645
  • 4
  • 29
  • 81
  • is this the same as https://stackoverflow.com/q/29810331/2536029 – mnagel Jul 20 '17 at 20:32
  • Consider the answer to https://stackoverflow.com/q/3161204/1256452 - what you probably really want to do is to set a *tag* on some particular commit, and then compare the tagged commit ("the source as remembered from here") to the tip of the branch ("the source as remembered as the latest commit on branch"). – torek Jul 20 '17 at 20:34
  • Possible duplicate of [Is there a quick way to "git diff" from the point or branch origin?](https://stackoverflow.com/questions/29810331/is-there-a-quick-way-to-git-diff-from-the-point-or-branch-origin) – Kat Jul 20 '17 at 21:12

1 Answers1

1

Well, git doesn't really know when the branch was created; but there are often relatively easy ways to describe to git what you mean by "when the branch was created".

For example, if my_branch was created from a commit on master, you could say

git diff master...my_branch

This will find a "merge base" (common ancestor) between master and my_branch, and show the differences between that merge base and my_branch

Mark Adelsberger
  • 42,148
  • 4
  • 35
  • 52