switching a subdirectory managed by git to a submodule

后端 未结 2 592
失恋的感觉
失恋的感觉 2021-02-04 09:24

We used to have a local hack of delayed_job in a Rails app, in vendor/plugins/delayed_job. It was installed as a one-time event and checked into git in the main app repo.

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 09:49

    I absolutely WOULD NOT RECOMMENDED DOING THIS. You're going to have a lot of fallout since git doesn't know what to do when a directory changes types into a submodule. It would be a significantly better idea to remove the old folder, then make a new one with a different name.

    We have a repo used by many people (50+) and decided to make a submodule out of a folder. In order to not have to change some build scripts and the like we did the above change. But this makes git freak out, and so every old branch (pre submodule change) cannot be switched to without first deleting the folder and doing other nonsense, merges with old branches are extremely difficult, and worst of all our automated build system, which is distributed across several machines, totally broke and cannot be manually resolved like individual users can.

    So. Just don't do it. Git absolutely does not handle it gracefully.

提交回复
热议问题