I can ask for differences since I started on a feature branch:
git diff upstream-branch...
But it requires that I know what the upstream branch is. Is there a reference for the upstream branch, whatever it may be without me knowing before hand or having to dig for it? Like, I don't know:
git diff UPSTREAM...
As a one liner:
git diff @{u}...The upstream of a branch is composed of two parts, both of which can be set and retrieved with
git config. The remote part is easy, as given a branch namedB, it'sbranch.B.remote. The second half is much harder if you usegit config.1 Fortunately, since about Git version 1.8 or so, the@{upstream}suffix works for all things that parse branch names:is the upstream of branch
foo.@{u}is shorthand for@{upstream}, and standalone, meansHEAD@{upstream}.To get the symbolic name of the upstream, if that's what you need, use
git rev-parse --symbolic-full-nameorgit rev-parse --abbrev-ref. Note that if there is no upstream set for the current or given branch, you'll get an error fromgit rev-parse.1It's
branch.B.merge, but this must be run through thefetch =mappings for the given remote to find the right remote-tracking name. That is, suppose that branchbrhasbranch.br.remote = randbranch.br.merge = xyz. You must then runrefs/heads/xyzthrough theremote.r.fetchrules to come up with the remote-tracking name corresponding toxyzon remoter. There's no command-line command that will do this for you.