Marking a repo as a fork in github, after the fact

前端 未结 2 908
别跟我提以往
别跟我提以往 2021-01-17 08:46

We have a project that was forked a while back mostly via a copy/paste method. But there is still significant overlap between the repos.

Is it possible to retroactiv

相关标签:
2条回答
  • 2021-01-17 08:58

    As you don't want to "squash" your commits into a single file what you could do is:

    • Fork the "original" repository
    • Create a pull request from your "copy and paste" repo to the fork

    Or you could take a look at how to merge two repositories like in this post. Like they did there you could add your "c&p repo" to the fork as a subtree, like it is explained in detail over here.

    This are the steps taken in the guide:

    git remote add -f c&prepo /path/to/c&prepo
    git merge -s ours --no-commit c&prepo/master
    git read-tree --prefix=vendor/c&prepo/ -u c&prepo/master
    git commit
    

    However even with those methods you aren't able to merge the whole repositories but only specific branches. What you could do is i.e. create a pull request (described in my first method) for each branch, which could take up some time depending on your branching model.

    I don't think there actually is a solution where you can merge two different repositories while keeping their commit history and branches at the same time. Best of luck to you.

    0 讨论(0)
  • 2021-01-17 09:02

    you should try something along the lines fo this:

    • create a real fork of the original project in github;
    • set this up as a remote of your copy/pasted fork (git add remote ...)
    • then rebase your work on top of this (git rebase)
    0 讨论(0)
提交回复
热议问题