What is the preferred way to manage schema.rb in git?

前端 未结 8 890
醉酒成梦
醉酒成梦 2020-12-01 07:05

I don\'t want to add schema.rb to .gitignore, because I want to be able to load a new database schema from that file. However, keeping it checked

8条回答
  •  时光取名叫无心
    2020-12-01 07:48

    Instead of using .gitignore, use separate branches: Develop which omits schema.rb and Test and Deploy which include schema.rb. Only make code changes in the Develop branches and never merge from Test into Develop. Keep schema.rb in a separate branch:

    Developer A             
        Develop      --------             
        Local Schema          \           Your Repo
        Test                    --------->    Dev A
                                --------->    Dev B
    Developer B               /               Master
        Develop      --------                 Schema
        Local Schema                          Test
        Test                                  Deploy
    

    In Git, branches are pointers to collections of file contents, so they can include or exclude particular files as well as track file versions. This makes them flexible tools for building your particular workflow.

提交回复
热议问题