我可以获得分支及其遥控器列表吗?

时间:2013-01-21 10:00:01

标签: git

我可以通过以下方式看到我当地的分支机构:

$ git branch
  1364_29
  master
* pp_master

这些分支来自不同的远程存储库,我知道找出他们来自哪个回购的唯一方法是检查我的.git/config

$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@github.com:myshare/webkit2-pp.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "base"]
        url = git@github.com:myshare/base.git
        fetch = +refs/heads/*:refs/remotes/base/*
[branch "pp_master"]
        remote = origin
        merge = refs/heads/pp_master
[branch "1364_29"]
        remote = base
        merge = refs/heads/1364_29

有没有简单的方法列出他们的关系?例如:

$ git ...
  1364_29    base/1364_29       git@github.com:myshare/base.git
  master     origin/master      git@github.com:myshare/webkit2-pp.git
* pp_master  origin/pp_master   git@github.com:myshare/webkit2-pp.git

1 个答案:

答案 0 :(得分:0)

您可以使用git branch -agit branch -r

如果您使用git branch -a,则输出的内容为:

  develop
* feature/shopping_cart
  master
  release/v1.1
  remotes/origin/develop
  remotes/origin/feature/shopping_cart
  remotes/origin/feature/login
  remotes/origin/master
  remotes/origin/release/v1.1

如果您使用git branch -r,则输出的内容为:

  origin/develop
  origin/feature/shopping_cart
  origin/feature/login
  origin/master
  origin/release/v1.1