与这个问题一样 - How do I clone all remote branches with 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
项目忽略vendor / extensions目录中的任何内容,而git@github.com:viatropos/mycart.git
项目没有,因为只有这一个主项目/目录(mycart)?
答案 0 :(得分:1)
你的意思是.gitignore
“忽略......中的任何内容”?此文件也是版本的,因此您可以在一个分支上添加.gitignore的供应商/扩展,并在另一个分支上删除它