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

后端 未结 4 728
梦毁少年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条回答
  •  萌比男神i
    2020-12-01 06:19

    One way to do this is with git rebase. By keeping your private changes as a few commits off the end of your master, you can commit public stuff to the master branch (or whatever you choose your working branch to be), and then rebase your private branch against master whenever you want to update.

    Another way to handle this is to keep template configuration files in Git, such as frobozz.config.template. In your working directory, copy frobozz.config.template to the (unversioned) frobozz.config and modify. Just be sure to back up your working directory too, if you need your local changes to be backed up.

提交回复
热议问题