与这个问题相同 -如何使用 Git 克隆所有远程分支?,如果我像这样设置了 Github 存储库:
$ git clone git@github.com:viatropos/spree.git mycart
$ cd mycart
$ git branch
* master
$ git remote add origin git@github.com:viatropos/mycart.git
fatal: remote origin already exists.
$ git remote add myfork git@github.com:viatropos/mycart.git
$ git branch -a
* master
origin/0_8_5
origin/0_9_2
origin/494-rake-task-for-default-data
origin/598-ruby-19
origin/611-refactor-charges-to-use-calculators-and-be-polymorphic
origin/811-refactor-payment-gateways
origin/HEAD
origin/master
origin/nested_attributes
origin/slicehost
origin/taxonomy_landing
origin/v9_592_tmp
$ git checkout -b slicehost origin/slicehost
Branch slicehost set up to track remote branch refs/remotes/origin/slicehost.
Switched to a new branch "slicehost"
$ git branch
master
* slicehost
...我该如何做到这一点,以便原始git@github.com:viatropos/spree.git
项目忽略供应商/扩展目录中的任何内容,而git@github.com:viatropos/mycart.git
项目没有,因为只有这个主项目/目录(mycart)?