8

Background: I have a situation similar to this but the solution there doesn't solve my problem. On GitHub I forked a fork of a project:

Original -> SomeonesFork -> MyFork

I forked from SomeonesFork in order to clean up some changes they had made and send a pull request back to the original repo. Since then I have also sent to pull requests direct to the original which were accepted.

However, I would prefer my repo to be a direct fork of the Original instead of having the SomeonesFork intermediary. (Makes things much easier on GitHub.) I set the original as the upstream and pushed to my fork, but GitHub still says it's a fork of SomeonesFork.

If I try to fork the original again I just get sent to the one that already exists. From research it looks like GH doesn't allow multiple forks.

So my question is: is it safe to simply delete the fork I have right now, then re-fork the original? Does this cause problems in git or GitHub anywhere?

Community
  • 1
  • 1
DisgruntledGoat
  • 70,219
  • 68
  • 205
  • 290
  • 1
    I have deleted forks with open pull requests against them with no adverse effects. The pull request is "sent" to the repo owner as a patch file. Just try sticking `.patch` onto the end of any pull request or commit URL on github to see the patch file contents in plain text. – Treffynnon Jan 02 '13 at 15:45
  • @Treffynnon there aren't any open pull requests and my current local repo is exactly the same as the original at the moment. – DisgruntledGoat Jan 02 '13 at 15:47
  • 1
    Like I say I have had no issue deleting them. I regularly delete forks in my account where I have made fixes for other people and they have accepted my pull requests. I like to keep my account clean. There is no real link between two github repos anyway as they both contain copies of the same code hence the distributed nature of git. – Treffynnon Jan 02 '13 at 15:51
  • OK, feel free to write that as an answer :D – DisgruntledGoat Jan 02 '13 at 15:54

1 Answers1

15

Git is a distributed system and there is a copy of all the code in all repos that the code has been committed or pushed into. References between repositories are minimal text flags that mention where a merge commit came from. There is no real link between them.

I have deleted many forks on github in the past with no ill effects. The pull request is "sent" to the repo owner as a patch file. Just try sticking .patch onto the end of any pull request or commit URL on github to see the patch file contents in plain text. Here is one that someone else requested against a project I maintain: https://github.com/j4mie/paris/pull/35.patch

Therefore it is self contained and you deleting your fork won't effect the availability of this patch to the upstream repo owner.

Treffynnon
  • 21,365
  • 6
  • 65
  • 98
  • 4
    So you are saying that we can delete the fork once we have submitted a pull request, even **before** it is accepted? – Pacerier Aug 13 '15 at 10:27