忽略稳定中的文件夹,但不忽略开发分支中的文件夹
我的项目有以下文件夹结构
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试组合使用
.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: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.devel
branch, you could have.gitattributes
referring to a custom merge driver for ignoring the.gitignore
coming fromtest_unit
folders from themaster
branch, and keeping their own version of.gitattributes
.That way, you can define
.gitignore
intest_unit
folders in themaster
branch: they won't impactdevel
branch in case of merge.我知道您是新来的,我也是,但是如果您格式化您的问题,将会吸引更多答案。也许是一个显示文件夹结构的列表,如下所示:
这将变成:
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:
That would turn into: