If you're on a given branch, and you want to compare your working copy with the upstream branch you're tracking, use:
git diff @{upstream}
If you want to compare your current HEAD with the upstream branch (thanks @Arijoon):
git diff @ @{upstream}
If your upstream isn't set, you can use @{push}
to get a diff against the branch you are set to push to (also from @Arijoon's comment):
git diff @{push}
Courtesy of this answer, the git documentation for specifying revisions has:
<branchname>@{upstream}
, e.g.master@{upstream}
,@{u}
The suffix@{upstream}
to a branchname (short form<branchname>@{u}
) refers to the branch that the branch specified bybranchname
is set to build on top of (configured withbranch.<name>.remote
andbranch.<name>.merge
). A missingbranchname
defaults to the current one.