Ignore folder in stable, but not in devel branch

一笑奈何 提交于 2020-01-13 17:09:52

问题


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.


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/1927339/ignore-folder-in-stable-but-not-in-devel-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!