shortz: How to Create Subfolders in Your GitHub Repository

Welcome! My name is Tomasz Buga, and this is shortz — short articles series that provides you solutions for your Software Development issues with simple to follow step-by-step guides.

Why would you want to create subfolders in your GitHub repository in the first place?

My answer is the monorepo.

I’ve encountered this issue recently when I was trying to create a monorepo for the app built with Spring Boot, PostgreSQL, and Angular. I had two separate GitHub repositories — one with a backend, and the second one with a frontend part of the application.

I wanted to use those codebases for my Test Automation Framework series, but since it’s not related to the Spring/Angular development, I wanted to make the setup, as quick as possible, for the people that would like to learn Test Automation from scratch.

Docker-compose was my go-to solution. A couple of hours later I had everything working like a charm. Sadly — I couldn’t make git commit with backend & frontend directories, as they were recognized as separate Git repositories.

Quick Google-fu & StackOverflow came to the rescue — as always.

The guide I’m going to write down below is based on the most upvoted answer in this thread provided by the users: softvar & Peter Mortensen

How to create subfolders in your GitHub repository?

Important: To create a new subfolder there has to be at least one file within that subfolder (it’s related to the Git design)

Video tutorial ripoff from the StackOverflow’s thread, so that no one can accuse me of not creating original content, lol
  1. Go to the repository on your GitHub page, where you’d like to create a subfolder
  2. Click on the Add File > Create new File
  3. In the filename input field type folder name and follow it by “/” sign to create a new subfolder. You can use “../” to go up by one folder, and backspace enables you to edit the parent folder’s name

All the best,

Tomasz Buga, SDET


All illustrations made by Tomasz Buga



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tomasz Buga

Tomasz Buga

Software Development Engineer in Tests. Passionate about programming. Experienced, former employee of the insurance industry. Graphic designer by choice.