How can I sync files in two different git repositories (not clones) and maintain history?

后端 未结 2 1372
时光取名叫无心
时光取名叫无心 2020-12-30 09:53

I maintain two different git repos that need to share some files, and I\'d like the commits in one repo to show up in the other. What\'s a good way to do that for ongoing ma

2条回答
  •  孤城傲影
    2020-12-30 09:55

    I'm assuming you want perlfaq history in perl repo. I'd do this (in a perl repo)

    git remote add perlfaq git://perlfaq... # real uri
    git checkout perlfaq/master -b perlfaq
    git checkout master # or whatever
    git merge perlfaq
    

    contrary to popular belief git does not have to have a common history to perform merge. I know I was merging 3+ repo's this way in regen2. This may be painful the first time. But after that it shouldn't be too painful. Unfortunately you can only merge 1-way but you can probably cherry-pick patches from the perl repo into perlfaq if you want.

提交回复
热议问题