Is there a quick way to "git diff" from the point or branch origin?
You can find the branch point using git merge-base
. Consider master
the mainline and dev
the branch whose history you are interested in. To find the point at which dev
was branched from master
, run:
git merge-base --fork-point master dev
We can now diff dev
against this basis:
git diff $(git merge-base --fork-point master dev)..dev
If dev
is the current branch this simplifies to:
git diff $(git merge-base --fork-point master)
For more information see the git-merge-base
documentation.
Use git diff @{u}...HEAD
, with three dots.
With two dots, or with HEAD
omitted, it will show diffs from changes on both sides.
With three dots, it will only show diffs from changes on your side.
Edit: for people with slightly different needs, you might be interested in git merge-base
(note that it has plenty more options than the other answer uses).
You can diff the current branch from the branch start point using:
git diff (start point)...
Where (start point) is a branch name, a commit-id, or a tag.
Eg if you're working on a feature branch branched from develop
, you can use:
git diff develop...
for all changes on the current branch since the branch point.
This was already mentioned in a comment, but I think it deserves answer status. I don't know what it will do since last rebase.