This is not Find out which remote branch a local branch is tracking, If I have mulitple remotes, I might have "master" in all of them. git branch
returns master but I don't know if the master branch I'm on is in remoteFoo or remoteBar. For example, I might do:
git clone someRepo.git
cd someRepo
git remote add anotherRemote otherremoteURL
Then git remote
shows
someRepo
anotherRemote
I can do git checkout -b master someRepo/master
or git checkout -b master anotherRemote/master
and git branch
will say "master" in both cases. How do I get back the first part, "someRepo" or "anotherRemote"?
You'd think I could use git remote show
but it requires an argument, the name of the remote you want information on.
$ git remote show origin
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
$ git remote show
someRepo
anotherRemote
With git branch
I get an indication of what is current:
$ git branch
hold
* master
old-stuff
refactor
but there's no "*" in git remote
output.