IMerin
IMerin

Reputation: 75

How do I manage two diverging codebases in git?

I have a legacy codebase (Legacy), and a new codebase (New).

New will be based directly off legacy, but will eventually diverge down its own path. Legacy will continue to to receive support.

What is the best way to sync changes that are common between both codebases?

Upvotes: 1

Views: 204

Answers (2)

0x1gene
0x1gene

Reputation: 3458

You can make changes in a separate branch (security patch for example) and then you merge the "security patch" to your "Legacy" and "New" branch.

The git-flow is a good illustration for thie use case. I doesn't match 100% to your use case but you can imagine that "master" is you "Legacy" and "develop" is your "Diverging branch" in that example:

http://nvie.com/posts/a-successful-git-branching-model/

Git flow

Upvotes: 1

Michael Durrant
Michael Durrant

Reputation: 96484

You can use branches and then rebase or merge changes from one to the other as needed.

You will need to fix merge conflict when the same lines in the same files have been changed, otherwise git can handle merging changes tro the same files (as well as adding new files).

Upvotes: 1

Related Questions