Jamie Redmond
Jamie Redmond

Reputation: 731

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.

Upvotes: 4

Views: 10953

Answers (3)

lazylead
lazylead

Reputation: 1979

From my perspective each GitHub project (based on your question you have a repo there) should have:

  1. Integration with CI servers (Travis CI, Circle CI, etc)
  2. .github folder with issue/pull requests templates (example https://github.com/zold-io/zold/tree/master/.github)
  3. .gitingore to avoid accidentally committed temporal/local files
  4. .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)
  5. .rubycop.yml (if it's a ruby project)
  6. Add the following badges to your readme.md
  • Gem Version version of your ruby gem
  • License: MIT license details
  • Commit activity commit activity per year to hightlight the status of the project
  • Hits-of-Code More about HoC here https://www.yegor256.com/2014/11/14/hits-of-code.html
  • Build Status Build Status the status of the latest builds
  • Dependency Status the status of dependencies (obsolte or not)
  • Known Vulnerabilities show the vulnurabilities count(if any) for the dependencies
  • Maintainability Rating Codebeat Codacy Badge SQ coverage Codecov Code Climate as code quality badges

Projects from the examples above:

Upvotes: 0

Peter Coulton
Peter Coulton

Reputation: 55789

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

Upvotes: 3

Alan Haggai Alavi
Alan Haggai Alavi

Reputation: 74202

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

Upvotes: 3

Related Questions