GitHub is an incredibly useful program for tracking the changes made by colleague software developers and during app version control. Unfortunately, it is not possible to delete folders on the GitHub website. Whilst you can delete GitHub files by opening them up and left-clicking the Trash/Bin icon, you can only delete folders in GitHub by doing so through a desktop GUI Local Git Repository, like Tower Git client.
This is, unfortunately, an unavoidable fact when using GitHub. As such, we will show you how to delete folders in GitHub through a Local Git Repository (using Tower Git client as the example).
Before beginning this tutorial, ensure that you have downloaded a Local Git Repository for GitHub with which you’re comfortable. You will then have to clone your online repository and open it in the client/program on your desktop. Once you have done so, you can begin.
For any additional information, or if you have further questions pertaining to GitHub and folder deletion, please see our FAQ section at the end of this article.
Table of Contents
- How to delete a folder in GitHub (via a Local Git Repository)
How to delete a folder in GitHub (via a Local Git Repository)
- From your computer’s desktop, open your Local Git Repository (e.g. Tower Git client)
- Find the project containing the unwanted folders by navigating through ‘Repositories’ and selecting the right project, and then the right version of the project
- Note: You will first have to clone the repository from the online version of GitHub, and open it in the Local Git Repository of your choice.
- Next, select the folder(s) you wish to delete in GitHub by left-clicking the first, and then holding CTRL/CMD and left-clicking the others, until your selection is complete
- Finally, simply either press DELETE on your keyboard, or right-click in the highlighted selection of unwanted folders, and select ‘Move to Trash’ or ‘Delete’ from the pop-up options.
- You have successfully deleted a folder or several in GitHub via a Local Git Repository.
And there you have it! With a Local Git Repository/GUI, deleting folders is super easy. If you still have questions, or would like to learn more on the subject, see our FAQs below.
What are folders in GitHub?
GitHub provides Internet hosting for version control (of various programs and apps), as well as software development, using Git (which is a program used to track the changes software developers make to their code files and folders).
Most users tend to use GitHub through the www.github.com website. However, GitHub is also available to use through desktop GUIs (graphic user interfaces). GUIs allow GitHub users a greater range of options and make the experience generally smoother.
A folder in GitHub is like a folder anywhere else. It is a created source containing various different files. You may create any number of folders in GitHub to better organize your various code files, READMEs, and so on.
Unfortunately, you cannot delete a folder in GitHub directly via the website program. Instead, you can only delete individual files. Even if you were to empty an entire folder of files this way, you would still not be able to delete the folder itself.
You can, thankfully, delete GitHub folders if you use a GUI for GitHub, like Tower Git client. We will instruct you on how to delete a folder in GitHub through a GUI only.
How do I clone my online Git Repository for use offline, through my desktop?
Here’s a free eBook from Git Tower, explaining various GitHub functions, including how to clone your repository for offline use: https://www.git-tower.com/learn/git/ebook
Why would I want to delete a folder in GitHub?
GitHub allows users to track the changes made to various lines of code, files, and folders full of code files for purposes of software development and version control. Folders are an integral part of much software development since they organize code files that would otherwise be far too numerous and similar to differentiate between with any degree of speed or certainty.
However, with version control or in many instances of software development, there can come times when folders that were created earlier in the process become no longer necessary. Perhaps in version control, a part of an app designed for the previous version is slated to be removed from the update. To do so, you’d want to delete the folder containing the code files pertaining to this part of the app.
This is, of course, but one example of a reason for wanting to delete folders in GitHub, but it gives a good idea of why you might want to. Whatever your reasoning, to learn how to delete a folder in GitHub, follow our tutorial up above.
Can I recover an accidentally deleted folder in GitHub?
When deleting folders in a desktop GitHub GUI, you are simply moving those folders (and/or files) to Trash. Thus, you do have a generous window of time during which you can elect to “Restore” those deleted folders.
To do so, navigate to your Trash/Trash folder, locate the deleted folders, highlight all the ones you wish to restore, and then right-click on them and select “Restore”. Alternatively, highlight them and then click File > Restore.
Can I delete multiple folders in GitHub at once?
You can indeed delete multiple folders in GitHub at once, provided you are doing so through a desktop GUI for GitHub (remembering that you cannot delete GitHub folders online)
To do so, simply select several folders at once by clicking on the first unwanted folder, and then holding CTRL/CMD on your keyboard whilst using the ARROW keys to select the rest of the unwanted folders (or, alternatively, using repeated left-clicks to select folders not arranged adjacently. Finally, right-click anywhere in the selection, and select ‘Move to Trash’ or ‘DELETE’, or press the DELETE button on your keyboard.