As of February 18, 2021, the “Unknown Repository” issue has been resolved. You should be ok to delete repositories once all the branches have been merged.
Deleting forked repositories will erase history from your Pull Requests.
Deleting a forked repository will delete any information associated with your repository. This can retroactively affect any references to your repository, including pull requests that have already been merged. (See Pull request displays “unknown repo” after deletion of fork)
Your comments and commits should be preserved on any pull requests that were associated with your repository, but you will do so at your own risk.
However, deleting old branches after a merge is perfectly safe.
While deleting repositories should be avoided, deleting unused branches is perfectly acceptable. In fact, GitHub encourages you to delete old branches.
Tidying up after Pull Requests
At GitHub, we love to use Pull Requests all day, every day. The only trouble is that we end up with a lot of defunct branches after Pull Requests have been merged or closed. From time to time, one of us would clear out these branches with a script, but we thought it would be better to take care of this step as part of our regular workflow on GitHub.com.
Starting today, after a Pull Request has been merged, you’ll see a button to delete the lingering branch:
If the Pull Request was closed without being merged, the button will look a little different to warn you about deleting unmerged commits:
Of course, you can only delete branches in repositories that you have push access to.
Enjoy your tidy repositories!
Alternatively, if you really don’t want to keep them around, you can archive a repository to indicate it is no longer actively maintained.
- GitHub Blog: Tidying up after Pull Requests
- GitHub Blog: Deleting a repository
- GitHub Help: Deleting and restoring branches in a pull request
- GitHub Issues: Pull request displays “unknown repo” after deletion of fork
If your pull request got accepted and you haven’t made any other changes that you might use personally, you should delete it.
- Deleting doesn’t harm anything.
- You can always refork if you need to
- It cuts down on useless repos in search results when people are searching for something
- If you use your GitHub as a sort of resume for potential jobs/contracts, it looks better if you don’t have dozens of forked repos that you’re not currently working on. You’ll appear more efficient.
- It helps your own sanity when you don’t have to page through hundreds of useless repos.
- Its better for GitHub. 🙂
You can delete your fork as soon as you submit a Pull Request, regardless if it’s merged or not. GitHub stores all PRs in the upstream repository, meaning proposed changes are tracked even if the fork is deleted.
That simplifies the decision.
You may still want to keep the fork if:
- You’ll be contributing more right away (e.g. extend existing PR or open new PRs)
You may want to delete the fork if:
- You want a clean portfolio of projects under your name