忽略稳定中的文件夹,但不忽略开发分支中的文件夹

发布于 2024-08-15 05:57:49 字数 283 浏览 2 评论 0原文

我的项目有以下文件夹结构

src/
   test_unit/
   package1/
      test_unit/
   package2/
      test_unit
output/

在我的开发分支中,所有文件夹都应该受版本控制,但是 master/stable 分支应该忽略而不是合并 test_unit/ 和 output/ 文件夹。

我怎样才能实现这个目标?使用 .gitignore 它将不起作用,因为 .gitignore 将被合并 树枝之间。

I have the following folder structure for my project

src/
   test_unit/
   package1/
      test_unit/
   package2/
      test_unit
output/

In my devel branch all folders should be version controlled, but
the master/stable branch should ignore and not merge test_unit/ and output/ folder.

How can I achieve this? With .gitignore it won't work because .gitignore will be merged
between the branches.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

九命猫 2024-08-22 05:57:49

尝试组合使用 .gitignore.gitattributes 文件:

  • master/stable 分支中,您可以拥有 .gitattributes引用自定义合并驱动程序,该驱动程序将有效地忽略来自 test_unit 文件夹的 .gitattributes.gitignore
  • devel 分支中,您可以让 .gitattributes 引用自定义合并驱动程序,以忽略来自 test_unit.gitignore > 来自 master 分支的文件夹,并保留自己的 .gitattributes 版本。

这样,您就可以在 master 分支的 test_unit 文件夹中定义 .gitignore:它们不会影响 devel合并时的分支。

Try a combination of .gitignore and .gitattributes files:

  • in master/stable branch, you could have .gitattributes referring to a custom merge driver which would effectively ignore the .gitattributes and .gitignore coming from test_unit folders.
  • in devel branch, you could have .gitattributes referring to a custom merge driver for ignoring the .gitignore coming from test_unit folders from the master branch, and keeping their own version of .gitattributes.

That way, you can define .gitignore in test_unit folders in the master branch: they won't impact devel branch in case of merge.

樱娆 2024-08-22 05:57:49

我知道您是新来的,我也是,但是如果您格式化您的问题,将会吸引更多答案。也许是一个显示文件夹结构的列表,如下所示:

 - List item
 - List item
  - List item
 - List item

这将变成:

  • 列表项
  • 列表项
    • 列出项目
  • 列表项

I know that you're new here—so am I—but your question would attract more answers if you formatted it. Perhaps a list showing folder structure, like this:

 - List item
 - List item
  - List item
 - List item

That would turn into:

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