Git Repository Names

Abdul Jabbar Jul 25, 2022
  1. Rules for Naming Repositories in Git
  2. Example of a Git Repository Name
  3. Conclusion
Git Repository Names

In our everyday life, calling someone by its name at the time of interaction is significant. After all, their name is most importantly linked to their identity, which is the simplest way to get someone’s attention.

And above all, the name must be concise so that other people don’t feel any problem calling out their name or using it.

The same is the case in Git. The naming of Git repositories should be consistent and compatible so that users of your Git account can access their required repository easily, without any hassle, making your work more authentic and professional using those names.

As said by someone for Git repositories: “Great repository names are short and memorable”.

Rules for Naming Repositories in Git

Choosing a concise and up-to-the-mark repository name is a big task while using Git. Two rules should be followed when naming a repository in Git.

  1. The repository name should be unique according to your account.

    That means your repository name should be different from your teammate’s. For example, if your repo name is my-best-repo, and your teammate also had a repo named my-best-repo.

    It isn’t possible because having two repositories with the same name under one account is impossible while using Git.

    That means that someone else can have a repository on GitHub named my-awesome-repo, and you can also have one. You cannot, however, have two repositories by the same name under your account.

  1. Choose a concise and compatible name that reflects your project.

    People name their repositories according to their preferences; some prefer hyphens - to separate words, while some use underscores _.

    This all depends on one’s personal preference, any character except space and tab could do the separation. One should also follow the naming conversions according to the team’s preferences and rules.

Example of a Git Repository Name

Following the above-given suggestions, we will look at what our repository should look like. We will divide our repo name into three sections separated by hyphens.

section1-section2-section3
  1. Section 1 defines the project name on which we work as a team.
  2. Section 2 defines the project’s purpose and project definition.
  3. Section 3 defines the language or framework of the project.

This might look as follows.

Air-SoapAPI-CSharp

The sections mentioned above can further be separated through hyphens if we want to split them, for instance, if we separate section 2 from the above example, Soap-API.

Conclusion

In this article, we have summarized the criteria for a repository name in Git, which include:

  1. Descriptive
  2. Consistent
  3. Brief (short/succinct)
  4. Future-friendly
  5. Extensible
  6. Reusable
  7. Contextual
  8. Readable
Author: Abdul Jabbar
Abdul Jabbar avatar Abdul Jabbar avatar

Abdul is a software engineer with an architect background and a passion for full-stack web development with eight years of professional experience in analysis, design, development, implementation, performance tuning, and implementation of business applications.

LinkedIn

Related Article - Git Repository