两个 Git 存储库的项目部分 - 如何忽略每个存储库的不同文件?
与此问题相同 - 如何克隆所有远程与 Git 分支?,如果我已经像这样设置了 Github 存储库:
$ git clone [email protected]:viatropos/spree.git mycart
$ cd mycart
$ git branch
* master
$ git remote add origin [email protected]:viatropos/mycart.git
fatal: remote origin already exists.
$ git remote add myfork [email protected]: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
...我如何使其成为原始 [email protected]:viatropos/spree.git
项目会忽略供应商/扩展目录中的任何内容,而 [email protected]:viatropos/mycart.git
项目没有,鉴于只有这一个主项目/目录(mycart)?
Along the same lines as this question - How do I clone all remote branches with Git?, if I have set up a Github repository like so:
$ git clone [email protected]:viatropos/spree.git mycart
$ cd mycart
$ git branch
* master
$ git remote add origin [email protected]:viatropos/mycart.git
fatal: remote origin already exists.
$ git remote add myfork [email protected]: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
... How do I make it so the original [email protected]:viatropos/spree.git
project ignores anything in the vendor/extensions directory, while the [email protected]:viatropos/mycart.git
project doesn't, given there's only this one main project/directory (mycart)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的意思是“忽略...中的任何内容”?该文件也是版本控制的,因此您可以将供应商/扩展添加到一个分支上的 .gitignore 并在另一个分支上将其删除
You mean
.gitignore
by "ignores anything in ..."? This file is also versioned, so you can add vendor/extensions to .gitignore on one branch and remove it on another