Git - determine branch remote source

Kenneth Burgener kenneth at
Tue Feb 8 08:55:07 MST 2011


While we are on the subject of Git...

How does one determine the source remote (and branch) for a local 
branch?  The reason I ask is that the default action (if you don't 
specify a remote) for a push and pull is to use the remote attached to 
the current branch.  It would also just be nice to know where the code 
came from, if you have forgotten.

   git clone git://[remote1]
   git remote add myremote git://[remote2]
   git fetch myremote
   git checkout -b mybranch myremote/master
   ?? check source of branch ??

The command 'git remote' shows the following:

The command 'git branch -a' shows:
   * mybranch
   remotes/origin/HEAD -> origin/master

So if I just came back from a long night, and wasn't sure, what command 
do I use to determine which remote (and branch) is "mybranch" sourced from?

I did notice that ".git/config" does show everything I want, including 
the remote (and branch) that this branch was sourced from, but I am sure 
that is cheating, and not Git kosher.  Is there a Git command, something 
to the effect like 'git show branch mybranch' that would show 
myremote/master or even git://[remote2]/master?


More information about the PLUG mailing list