How to use a double verbose to print the name of the upstream branch on command line – 121

Ah Git. It is the gift that keeps on giving if you’re into studying developer tool usability.

Suppose you wanted to get the last commit ID and message while listing all your branches. The `–verbose` or `-v` for short will provide you with that information, e.g.

$ git branch –verbose -a

git branch --verbose -a

Yay! But while I was scanning the documentation, I came across this usability gem*

If given twice, print the name of the upstream branch, as well. (see also git remote show <remote> ).

Yep, if you do a

$ git branch -vv -a

you’ll get even more information! Note the blue text depicting the upstream branch.

git branch --v -a

*Specifying the –verbose option twice reminds me of old school text-adventure games where you’d have to look twice in the same location to find a second item. If you thought to do that, you’ll get a bonus or something. Now I might have to search the Git documentation for the common commands to see what other options exist where you have to specify a parameter twice!

 P.S. I can’t find in Visual Studio where to see the upstream branch. You can see all remote branches in the history view, but that’s not quite the same. Perhaps since  in Team Explorer (as far as I can tell) 1. you can’t rename a branch checked out from a remote tracking branch and 2. can’t checkout more than one remote tracking branch, it’s assumed that the upstream branch has the same name as your local branch. That’s my guess.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s