Add Github fork to existing repository

后端 未结 3 865
借酒劲吻你
借酒劲吻你 2021-01-01 12:57

I setup an Octopress project following the given instructions (http://octopress.org/docs/setup/) which have you create a Github repository, and create a local repository on

相关标签:
3条回答
  • 2021-01-01 13:24

    Although people tend to think of their repo on Github as the "official" one, remember that's a social distinction and not a technical one. From git's point of view every repo is on equal terms. That means as long as you have pulled every commit into your local repo, you can safely delete the one on Github. Then just fork the Octopress project on github, set it up as a remote on your local repo, and push. Git doesn't care which repo you originally got any given commit from. It "just works."

    0 讨论(0)
  • 2021-01-01 13:31

    I'm unaware of any way to turn your blank github copy into a github fork after the fact, so

    If there isn't a way, can I safely delete my Github instance of Octopress, fork the original on Github, and then add a new remote from my local repository to the newly forked Octopress?

    is the way to go. Delete your own github repository, hit the fork button on the octoprocess repository and clone your fork to your local machine.

    If you've already made any changes that you with to keep, I'd say that using git format-patch to store them as a series of patch files and git apply-patch to apply those on a clone of your new repository is probably easier than using the old one as a remote (on your local machine).

    0 讨论(0)
  • 2021-01-01 13:44

    If I understand the OP. They have a Git repo, and they have now decided that it should have forked another repo. Retroactively they would like it to become a fork, without disrupting the team that uses the repo by needing them to target a new repo.

    I've thought about renaming a new repo into place. so if the team current clones, and fetchs, and pulls example.git

    1. setup a new repo that is a fork, example_fork.git
    2. rename example.git to example_deprecated.git
    3. quickly rename example_fork.git to example.git.

    I've heard that anyone who already had a clone would be met with an error of sorts (so that doesn't avoid the inconvenience as well as I would hope)

    I've also seen suggestions to use Force Push: Marking a repo as a fork in github, after the fact

    .

    But now I'm wondering if topic of discussion is more accurately worded as "setting the upstream remote of an existing repository". Discussed here: Adding remote upstream to git repo on bit bucket

    based on the feedback provided here: What does 'git remote add upstream' help achieve? I think it would basically allow retroactive forking like I want, and like I think the OP is asking for.

    I have not tried it yet.

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