Skip to content

How to delete a repository and branch in GitHub?

  • by
  • 4 min read

Those of you who use GitHub already know what a lifesaver it can be in almost any situation. If you’re working with a team on a project of any magnitude, GitHub is almost a necessity nowadays.

You start a new project, git init it and you get going. Before you know, you have a bunch of repos and twice the branches to those repos. Not every single one of those branches is useful and let’s face it, no one likes a littered GitHub account.

In this article, we’re going to discuss how to delete repositories, and branches from GitHub.

Also read: How to create a GitHub repository?

How to delete a GitHub repository?

Before we get to the steps, here’s a little something about deleting repos from GitHub. You need to have admin privileges or be the owner of the repo to be able to delete it (obviously).

Apart from this, if your repo is private, deleting it will delete all forks as well. If it’s public, the forks stay even when the core repository is deleted.

In either case, deleting the repo will permanently delete any release attachments as well as permissions assigned.  This action cannot be undone

Step 1: Go to GitHub and open up the main page of the repository.

Step 2: Click on the Settings button under the repository name. This will bring up a bunch of, you guessed it, settings about your repo. Scroll down to the Danger Zone section.

Step 3: Find and click on the Delete this repository button.

Step 4: GitHub will show a big warning box warning you of the consequences of deleting a repo. Go ahead and type in your Username/Repository name to make sure you’re deleting the correct repository.

Step 5: Once you type in the required information, the I understand the consequences, delete this repository button will become active. Click it to delete your repository.

 

Step 6: GitHub will then ask for your password to ensure that it’s you. Go ahead and enter that.

Finally, you’ll be redirected to your profile page. You’ll see a message stating your repo has been deleted.

Also read: How to change the homepage on Google Chrome?

Deleting branches in GitHub

Deleting branches is way simpler than deleting entire repos. Here’s how:

Step 1: Go to the home page of your repo and click on the Branches button.

Step 2: Scroll down to the branch you’d want to delete and press the trash can icon.

Also read: How to deactivate or delete your Twitch account?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>