Git workflow for maintaining an project extension fork?

前端 未结 2 1011
我寻月下人不归
我寻月下人不归 2021-02-05 16:05

We\'ve forked an OSS project on GitHub and are adding some custom extensions to it. We\'ll want to send some of the changes we make back to the original project (bug fixes and

相关标签:
2条回答
  • 2021-02-05 16:24

    It sounds to me like you have already answered your own question. Create a branch called "vanilla" or something which tracks upstream's master branch, and have a "master" branch which contains your custom extensions. Create branches for each thing you do. For bugfixes, start them off of "vanilla". For your own stuff, start them off of master. Every once in a while, merge vanilla into master. To get the bugfixes into your custom extensions branch, you could merge their branches into master directly, or just wait for upstream to accept your bugfix pull requests, and then the next merge from vanilla to master would contain the bugfixes. This seems like a very normal workflow.

    0 讨论(0)
  • 2021-02-05 16:29

    What you want to setup is a long term fork, to do this as you already figured out the solution could be setting up a special branch linked with the original "vanilla" project and have a master branch where you maintain your custom working copy.

    The only thing that you have to keep in mind (from my point of view) is that you shouldn't merge the two branch when you want to synch changes, but in this case (When Branches Diverge) there is the handy Git Cherry-Pick command that lets you take a single commit from one branch and apply it to another, this could be particularly useful in the case of maintaining a fork because you can easily exchange single commit from one branch to another ...

    0 讨论(0)
提交回复
热议问题