Thread (6 messages) flat view 6 messages, 4 authors, 2016-06-15

Re: set-upstream for existing branch...?

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:50:35

knittl venit, vidit, dixit 17.02.2011 10:25:
On Thu, Feb 17, 2011 at 9:23 AM, Michael J Gruber
[off-list ref] wrote:
quoted
Miles Bader venit, vidit, dixit 17.02.2011 08:24:
quoted
Hmm, on a related note, is there an obvious way to _show_ the current
branch's upstream...?

[I mean, which just prints out "origin/master" or whatever...]

Thanks,

-miles
git for-each-ref --format="%(upstream)" $(git symbolic-ref HEAD)

I can't come up with a better way of expanding @{u} without resolving
the resulting refname to a SHA1. You could do
what about

    git branch -vv

it will show all local branches with their upstream plus behind/ahead numbers
That's a very nice and useful output, but my impression was that Miles
was more interested in one branch (the current one), and I think Jay
gave the most direct solution. While it does go through the
resolve-describe-circle (compared to for-each-ref) it should still be
efficient.

Michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help