Reputation: 3569
Is there a shortcut to see the diff between my working tree and the upstream of the branch I'm on?
git checkout -b NewFoo --track ParentFoo
# make some changes...
git diff BaseFoo # Oops, I meant ParentFoo...
It's a little thing, but I have a lot of similarly named branches and it gets tiring having to remember the name of my upstream and type it all out. Since git knows what I'm rebasing off of, it should know how to diff with it.
Is there some command like git diff <upstream>
?
Upvotes: 0
Views: 525
Reputation: 4088
Is there some command like
git diff <upstream>
?
Yes, there is one.
git diff "@{upstream}"
From gitrevisions(7):
The suffix @{upstream} to a branchname (short form (branchname)@{u}) refers to the branch that the branch specified by branchname is set to build on top of (configured with branch.(name).remote and branch.(name).merge). A missing branchname defaults to the current one.
Upvotes: 3