In Git, how do I diff to the first commit of my branch?

You’ll want to use the triple dot syntax described in git help diff:

git diff otherbranch...

This is the same as:

git diff otherbranch...HEAD

which is the same as:

git diff $(git merge-base otherbranch HEAD) HEAD

The merge-base command prints the “best” (most recent) common ancestor, so the above command shows the difference from the most recent commit that HEAD has in common with otherbranch to HEAD.

Note you can use @{u} in place of otherbranch to see the changes you made since you diverged from the upstream branch. See git help revisions for details about the syntax.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)