Git: merging public and private branches while while keeping certain files intact in both branches

后端 未结 4 747
梦毁少年i
梦毁少年i 2020-12-01 05:52

I\'ve read a few git questions here, but could not find an answer to this one:

I have a public and a private branches where I want to allow certain files to diverge.

4条回答
  •  感情败类
    2020-12-01 06:18

    To be on the safe side, you can add a git attribute (see here for an example) for those private files.

    That way, you can define a script (a "merge manager") which will ensure the file including private informations will remain empty (or with a public content) if merged on the public branch, while keeping its local content if merged to the private branch.
    It means you can merge/rebase without thinking about that file.

提交回复
热议问题