It was a Wednesday afternoon, and I was busy re-organizing somethings on my portfolio. I also wanted to quickly clean-up my GitHub profile at the same time, as I had lots of repositories for personal projects that I never actually started working on or repositories that I created while following a tutorial, etc. Point is, my GitHub was full of repositories I didn't need, and they were just taking up space unnecessarily.
So I decided to get rid of those and delete the repositories one-by-one from the GitHub website. The process was time-consuming because I had to individually delete the repositories, and GitHub requires you to confirm the repository name before you can delete it. All in all, the process felt like something that can be easily automated.
Like one does, I did a quick Google search and found a tool that supposedly lets you bulk delete repositories. The interface of the app was incredibly confusing, and it ended up deleting repositories that I actually wanted to keep. So what ended up happening is that the app deleted the repositories I wanted to keep, and kept the ones I wanted to get rid of.
🤬💀
I had lost the repository for my biggest project, and because it was part of a forked network, you can't simply recover the repository from your account. I had to reach out to GitHub Support to get the repo back, but even then, I had lost all the years of releases I published on that repo. Long story short, my day quickly turned into a massive nightmare.
And then it hit me: there has to be a better and reliable way of doing this. With the free time I had because of lockdown, I decided to make my own app that lets you bulk delete repositories. My focus with this app was to build an interface that is incredibly simple to understand and use.
I started looking into the GitHub API to get started, and the endpoint for deleting repositories is pretty simple. So I quickly started making a React app that lets you view your repositories separated by Public and Private repositories. From there, you can select repositories you want to delete, and delete them all at once with a single click. The interface of the app, once again, is really simple and lets you clean-up your GitHub account with just a few clicks and without any of the hassle. There's a search feature to search for repositories on your profile, and there's a dark/light theme as well.
Meet GitCleanup: gitcleanup.com.
The app is completely open-source on GitHub, and you can even deploy your own instance on Heroku:
This was a fun little project for me, and I hope it's useful to the community ☺️
Top comments (13)
Design rocks, initiative awesome as I have a bunch of old forks that I'm too lazy to remove manually. But it is super scary to give repo delete rights to an external application I don't control
Yep, that's why you can deploy your own instance with your own OAuth app creds :)
Yeap, I love that part of the solution. Great project man. Many people will be happy twitter.com/alexellisuk/status/123... :D
Seems like a nice tool :)
maybe it can be used to move repos to organizations like the method described here dev.to/clsource/declutter-your-git... :D
so the code can be seen if there are any forks or people that would like to take a look.
Thanks !
The UI, is truly impressive.
Though, I guess I found a bug, the public api doesn't seem to be fetching all my repos and only the first 10-20.
Hey, thank you! How many repos do you have out of curiosity? I will look into this, and would appreciate if you could share more info on an issue on the github github.com/MehediH/GitCleanup
sure
Good work!
Cheers!
Awesome! I need to do this because I fork a lot of repos just to keep them in mind and then forget about them. Not a good plan, lol.
Amazing, I love the design you used.
It might be a bad idea to delete an abandoned repo, especially if some watching / starring it.
It is bad idea in general to delete shared something.
Had better "archive."
Yep I completely understand that -- I just couldn't think of a better word than "abandoned". In this case I am referring to repos for projects that you never ended up finishing.
Also, regarding "It is bad idea in general to delete shared something," the app shows if a repo has watchers/stars, so I guess that you won't be "knowingly" delete something that's shared.