784

I'm starting with git and GitHub and there's a project I'm watching on GitHub. I unintentionally clicked to fork it. Now it appears as a new project to me.

I have some doubts about it:

  • I know if commit or do another thing to my forked repo, it will be updated, but the updated code will take effect only after the project's author request the pull. Right?
  • If I go to admin panel on GitHub there's a delete option. If I delete it as the option above, will it make any effect in the original one or not?

I'd like to delete it. By now I'm just studying the code and don't really need the fork.

Russia Must Remove Putin
  • 374,368
  • 89
  • 403
  • 331
axcdnt
  • 14,004
  • 7
  • 26
  • 31
  • 29
    To clarify the terminology around pull requests: you make a change and request that the author pulls that change into their repository. You *request* and the author *pulls*. – Douglas Hill May 09 '15 at 01:30

15 Answers15

1338

By far the easiest way is to log in GitHub account:

  1. Click to your repository for example yourUsername/yourRepository for example mbaric/zpropertyz.
  2. Then in the main toolbar of GitHub click on Settings
  3. Scroll to the bottom of the page to the section called Danger Zone and you will find Delete this repository button
  4. When you click it another pop up will appear here you need to type in your Github username and the name of your repository in this format gitHubUsername/nameOfTheRepository and click on the button below which says: I understand the consequences, delete the repository
  5. If you are having trouble doing it, below are the images that can be checked…

2020-01-15 - Here are images. Enjoy. GHD1

GHD2

GHD3

GHD4

Martin Schröder
  • 4,176
  • 7
  • 47
  • 81
Matija
  • 17,604
  • 2
  • 48
  • 43
388

Deleting it will do nothing to the original project. Editing it will only edit your fork on your repo page.

Conner
  • 30,144
  • 8
  • 52
  • 73
  • 148
    It would be horrible security bug if you could affect someone else's project by forking it and then deleting the fork. – Keith Thompson May 18 '13 at 21:51
  • 12
    What happens if the original project gets deleted? Will my fork still work? Does it get deleted too? – unom Aug 31 '14 at 18:50
  • 17
    @unmircea Yes, your fork will still work: it just won't be able to merge "upstream". – bishop Sep 27 '14 at 03:08
  • 12
    I see. One more quick question. When I fork a project what happens when the initial project get's updated and so on. Does it flow downstream automatically? – unom Sep 27 '14 at 10:40
  • 13
    @unmircea No, you have pull down changes from the original project – Conner Jun 06 '15 at 18:41
  • I've always found it better to clone a project locally, and then push the clone to a new GitHub repo. This avoids a lot of the oddities and annoyances associated with GitHub forking. – William T Froggard Dec 12 '17 at 09:01
  • FYI, when you delete a fork, and you want to later fork the original master repo again, you cant. It says the fork exists, although it doesnt. – John Little Aug 14 '18 at 16:23
  • @KeithThompson, re "_It would be horrible security bug if you could affect someone else's project by forking it and then deleting the fork._" Not if you have access to both repositories/accounts, right? (It would be bad, but I wouldn't consider it a security bug, unless I'm missing the point here.) – wovano Nov 09 '21 at 08:32
  • @wovano I meant any random user's repo, one to which you ordinarily wouldn't have write access. – Keith Thompson Nov 10 '21 at 00:01
30

Just delete the forked repo from your GitHub account.

https://help.github.com/articles/deleting-a-repository/

  • If I go to admin panel on GitHub there's a delete option. If I delete it as the option above, will it make any effect in the original one or not?

It wont make any changes in the original one; cos, its your repo now.

Prashanth Sams
  • 19,677
  • 20
  • 102
  • 125
15

Sweet and simple:

  1. Open the repository
  2. Navigate to settings
  3. Scroll to the bottom of the page
  4. Click on delete
  5. Confirm names of the Repository to delete
  6. Click on delete
Pang
  • 9,564
  • 146
  • 81
  • 122
Gurjot Singh
  • 159
  • 1
  • 2
14

There will not be any harm deleting the forked repositories. You can again fork that. It won't change the original code. The flow is like this...

1) You fork a repository. Just think of this as another copy of code which you can access or make changes to. The url of this repository will be of the form https://github.com/your-user-name/original-repo.

2) You make some changes to that in your local machine and push them. Now the copy you created will be updated, but not the original one from which you have forked your repo.

3) If you want the changes you added to your forked repo to be applied to original repo(this may be helpful to the people who are organizing the repo) then you have to create a pull request which you can do through UI. Then if they like your contribution, they will merge that with their code.

Generally this is what open source organizations do.

aravindkanna
  • 663
  • 1
  • 7
  • 25
12

Deleting your forked repository will not affect the master (original) repository.

Like I have shown an example by deleting a forked repo.

This is my forked repo (Image)

Deleting the forked repo

And no changes to the original repository.

The master repo is something like an original one.

Forking is same as creating a xerox copy of the original one. Even if you get your xeroxed paper damaged, will it be that the original document also gets damaged? Obviously No.

So it's the same as that.

wovano
  • 4,543
  • 5
  • 22
  • 49
Prateek Chanda
  • 199
  • 3
  • 3
4

Answer is NO. It won't affect the original/main repository where you forked from. (Functionally, it will be incorrect if such an access is provided to a non-owner).

Just wanted to add this though.

Warning: It will delete the local commits and branches you created on your forked repo. So, before deleting make sure there is a backup of that code with you if it is important.

Best way would be getting a git backup of forked repo using:

git bundle 

or other methods that are familiar.

Skatox
  • 4,237
  • 12
  • 42
  • 47
Sagar Kulkarni
  • 2,072
  • 2
  • 16
  • 25
4

select project to delete->settings->buttom click delete button->enter name of the repositories

4

Select repo->Settings->(scroll down)Delete repo

Ashik Azeez
  • 404
  • 5
  • 8
4

A simple way to delete a repository on github:

  1. Open the repository you want to delete enter image description here
  2. Then click settings
  3. After that scroll to the bottom of the page enter image description here
  4. Click delete
  5. To confirm deletion, you need to write down the your github username and repository name that you want to delete enter image description here
  6. After that, click "I understand the consequences, delete this repository"
  7. And the repository was successfully deleted
indrarasendriya
  • 165
  • 1
  • 5
2

No, it will not affect your original repository, just make sure that the repo address looks like "youGitName/TheRepository" and not like "OtherPersonGitName/TheRepo".

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
Bruno Maia
  • 21
  • 2
2

Open the repository you want to delete on github and press the settings tab. Scroll to the end of the page and click on delete repository. Write the name of the Repository to confirm and click on delete like this one:

enter image description here

Shoaib Khalil
  • 1,874
  • 17
  • 10
1

I was also looking for a solution to this problem, especially for bulk deletes. I finally used this solution - https://github.com/yangshun/delete-github-forks.

Worked like a charm!!

indranil32
  • 140
  • 1
  • 9
0

I had also faced this issue. NO it will not affect your original repo by anyway. just simply delete it by entering the name of forked repo

SHANKAR YADAV
  • 29
  • 2
  • 3
0

There are multiple answers pointing out, that editing/deleting the fork doesn't affect the original repository. Those answers are correct. I will try to add something to that answer and explain why in my answer.

A fork is just a copy of a repository with a fork relationship.

As you can copy a file or a directory locally to another place and delete the copy, it won't affect the original.

Fork relationship means, that you can easily tell github that it should send a pull request (with your changes) from your fork to the original repository because github knows that your repository is a copy of the original repository(with a few changes on both sides).

Just for anybodies information, a pull request(or merge request) contains code that has been changed in the fork and is submitted to the original repository. Users with push/write access(may be different in other git servers) on the original repository are allowed to merge the changes of the pull request into the original repository(copy the changes of the PR to the original repository).

dan1st
  • 12,568
  • 8
  • 34
  • 67