2

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

$ 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
4

1 回答 1

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
于 2013-01-21T10:08:40.530 回答