How should I structure the files/directories in my Git repository?
I've just started using GitHub. I've set up my public key and and have git installed on OSX. I know the commands etc. from when I studied it at university.
What I want to know: Is there any "conventional" file structure that most GitHub members use? I notice a lot of people use 'src', 'test', etc. Does anyone have more information on the recommended file structure?
At 开发者_开发百科a guess I am thinking most developers use the same file structures for all their projects hence why they look similar. If that's the case what's the best file structure to use for my projects?
I don't want users to get confused by me using unconventional file structures.
Follow the conventions followed by the community of the particular programming language.
In Perl, we generally follow a structure like:
eg/ # example scripts
lib/ # for modules
scripts/ # scripts to use the modules
t/ # tests
CHANGES
LICENSE
README
There are recommended directory structures for certain project types that you'll find alot on github, e.g. Rails, gems, etc, but not for Git per se.
Rails - http://guides.rubyonrails.org/command_line.html#rails-generate
Ruby gems - http://seattlerb.rubyforge.org/hoe/
Java - http://java.sun.com/blueprints/code/projectconventions.html
C - Folder structure for a C project
From my perspective each GitHub project (based on your question you have a repo there) should have:
- Integration with CI servers (Travis CI, Circle CI, etc)
.github
folder with issue/pull requests templates (example https://github.com/zold-io/zold/tree/master/.github).gitingore
to avoid accidentally committed temporal/local files.gitattributes
for custom Git repo configuration (more https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes and https://git-scm.com/docs/gitattributes).rubycop.yml
(if it's a ruby project)- Add the following badges to your
readme.md
- version of your ruby gem
- license details
- commit activity per year to hightlight the status of the project
- More about HoC here https://www.yegor256.com/2014/11/14/hits-of-code.html
- the status of the latest builds
- the status of dependencies (obsolte or not)
- show the vulnurabilities count(if any) for the dependencies
- as code quality badges
Projects from the examples above:
- https://github.com/dgroup/docker-unittests (java)
- https://github.com/mattbrictson/gem (ruby)
精彩评论