How to add one git story to another?

I have a repository containing code for an old version of a website that is no longer used in master . The site was completely redesigned in the new repository, and the code and history from this repository were copied to a branch in the repo of the old site, call it new_site . I cannot combine new_site into master , as the stories are completely different.

I studied both submodules and subtrees, a little reconciled, but both of them seem relevant only when you are trying to save code from one project contained in a subdirectory of another project, and not when you want to insert two working trees on top of each other.

At this point, I would like the old code to stay where it is, and just add new_site on top of the current HEAD. Any idea how I can do this, or alternative suggestions for cleaning up this mess without blowing away the old code?

+6
source share
1 answer

General idea:

After you have imported the correct branch from A, you can use the graft point and then git filter-branch to include the graft history in the “true” story to get rid of the graft point.

+7
source

All Articles