For example, I have a RESTful service called Purchase Service. Should I name my repository:
purchaserestservice purchase-rest-service purchase_rest_service or something else?
What's the convention? How about in Github? Should public repositories follow some standard?
I'd go for purchase-rest-service
. Reasons:
What is "pur chase rests ervice"? Long, concatenated words are hard to understand. I know, I'm German. "Donaudampfschifffahrtskapitänspatentausfüllungsassistentenausschreibungsstellenbewerbung." "_" is harder to type than "-"
The problem with camel case is that there are often different interpretations of words - for example, checkinService vs checkInService. Going along with Aaron's answer, it is difficult with auto-completion if you have many similarly named repos to have to constantly check if the person who created the repo you care about used a certain breakdown of the upper and lower cases. avoid upper case.
His point about dashes is also well-advised.
use lower case. use dashes. be specific. you may find you have to differentiate between similar ideas later - ie use purchase-rest-service instead of service or rest-service. be consistent. consider usage from the various GIT vendors - how do you want your repositories to be sorted/grouped?
lowercase-with-hyphens
is the style I most often see on GitHub.*
lowercase_with_underscores
is probably the second most popular style I see.
The former is my preference because it saves keystrokes.
* Anecdotal; I haven't collected any data.
lowercase-with-hyphens
Without favouring any particular naming choice, remember that a git repo can be cloned into any root directory of your choice:
git clone https://github.com/user/repo.git myDir
Here repo.git
would be cloned into the myDir
directory.
So even if your naming convention for a public repo ended up to be slightly incorrect, it would still be possible to fix it on the client side.
That is why, in a distributed environment where any client can do whatever he/she wants, there isn't really a naming convention for Git repo.
(except to reserve "xxx.git
" for bare form of the repo 'xxx
')
There might be naming convention for REST service (similar to "Are there any naming convention guidelines for REST APIs?"), but that is a separate issue.
Maybe it is just my Java and C background showing, but I prefer CamelCase (CapCase) over punctuation in the name. My workgroup uses such names, probably to match the names of the app or service the repository contains.
If you plan to create a PHP package you most likely want to put in on Packagist to make it available for other with composer. Composer has the as naming-convention to use vendorname/package-name-is-lowercase-with-hyphens
.
If you plan to create a JS package you probably want to use npm. One of their naming conventions is to not permit upper case letters in the middle of your package name.
Therefore, I would recommend for PHP and JS packages to use lowercase-with-hyphens
and name your packages in composer or npm identically to your package on GitHub.
Success story sharing