Git - determine branch remote source

Kenneth Burgener kenneth at mail1.ttak.org
Tue Feb 8 08:55:07 MST 2011


Hi,

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:
   origin
   myremote

The command 'git branch -a' shows:
   master
   * mybranch
   remotes/origin/HEAD -> origin/master
   remotes/origin/master
   remotes/myremote/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?

Kenneth



More information about the PLUG mailing list