两个 Git 存储库的项目部分 - 如何忽略每个存储库的不同文件?

发布于 2024-08-20 13:02:18 字数 1716 浏览 9 评论 0原文

与此问题相同 - 如何克隆所有远程与 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

又怨 2024-08-27 13:02:18

您的意思是“忽略...中的任何内容”?该文件也是版本控制的,因此您可以将供应商/扩展添加到一个分支上的 .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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文