How do I combine two Git repositories, one a snapshot of the other with current history?

后端 未结 1 1105
野性不改
野性不改 2020-12-21 23:14

I need to do the inverse of this question.

So almost a year ago we split our Git repository off from itself by copying the current state of both branches into a new

相关标签:
1条回答
  • 2020-12-21 23:42

    Your mileage may vary and I may well have misunderstood the question and your intent, so I'll propose options with short summary:

    Consider stitching repos

    Perl CPAN has git-stitch-repo, nice module that streamlines git fast-export to git fast-import.

    Should linearize history.

    Subdir option

    Have two dirs instead of one. Or multiple dirs.

    You are following procedure for that already. Abandon final cherry-picking from your question and just have old repo as a directory along current one.

    Least troublesome, just glues repos together. Doesn't try linearizing history.

    Git subtree merge

    Merge subtree is a Git command, easier to use than both subtrees and submodules (and less administer-heavy).

    You may need to then use --follow when looking at git log for individual files (after the merge).

    Reexamine why you need it

    Are you certain it will be helpful? If you feed that old Git log to ELK, would indexed search fit your colleagues (and yourself) better? With possibility of setting some dashboards in Kibana? Or if you set git instaweb on a machine with old repo, so that folks can browse it through web, will it perhaps meet your demands?

    Consider git merge-repos

    Never tried, so can't recommend, but it's apparently for just such an occasion and it was written when git-stitch-repo was young. May be worth checking out.

    With some rewrite

    There is also an option with some history rewrite, with git filter-branch. Probably can be done with BFG as well.

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