忽略稳定中的文件夹,但不在devel分支中 [英] Ignore folder in stable, but not in devel branch

查看:80
本文介绍了忽略稳定中的文件夹,但不在devel分支中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have the following folder structure for my project

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

在我的devel分支中,所有文件夹都应受版本控制,但是 master/stable分支应该忽略并且不要合并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.

我该如何实现?使用.gitignore它将不起作用,因为.gitignore将被合并 在树枝之间.

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

推荐答案

尝试组合.gitignore.gitattributes文件:

  • master/stable分支中,您可以.gitattributes引用自定义合并驱动程序,该驱动程序将有效地忽略来自test_unit文件夹的.gitattributes.gitignore.
  • devel分支中的
  • 中,您可以使.gitattributes引用自定义合并驱动程序,以忽略来自master分支中test_unit文件夹的.gitignore,并保留其自己的.gitattributes版本.
  • 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.

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

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

这篇关于忽略稳定中的文件夹,但不在devel分支中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆