What information should add to your README

You should always include a README in the root directory of your GitHub repositories. A README is typically the first item that visitors will see when they arrive at your repository. This makes them the perfect place to tell people what your project is, why its useful, and how to get started using it. What you include in a given README will look different depending on the project, but here are some guidelines for getting started:

There are a number of different ways:

From GitHub:

  1. Check the Add a README file box when creating a repository from GitHub, or
  2. Click the green Add a README button that appears below your files on a GitHub repository that does not yet have a README
  3. Click the Add file button at the top of a repository’s landing page (next to the green Code button) > select + Create new file > name it README.md and add content > click Commit changes…

From RStudio (GUI):

  1. Use the Files pane to click Blank File > select Text File > type README.md

From the command line:

  1. Navigate to your repository’s root directory using cd (use pwd to verify / check your location) > type touch README.md

Things you should always include in your GitHub repository READMEs:

    • A README’s title is set to the repository name by default - change this!
    • Paragraphs or a bulleted list are both acceptable options
    • You may include an image or logo that represents the project
    • This includes information about the repository structure or file organization

The tree command-line tool prints a visual, hierarchical map of your directory. The nicely outputted tree can be pasted into your README to orient newcomers to your file organization.

Install tree:

Mac (requires Homebrew):

brew install tree

Windows (requires Chocolatey):

choco install tree

Alternatively on Windows, tree is available via Git Bash or WSL.

Generate your repository structure:

Navigate to your repository’s root directory, then run:

tree

Some useful flags:

Flag Description
-L 2 Limit depth to 2 levels (replace 2 with your preferred depth)
-a Include hidden files (e.g. .gitignore)
--gitignore Exclude files listed in .gitignore
-I "directory_name" Exclude a specific directory by name

Copy the output into your README inside a code block (use triple backticks) so it renders as fixed-width text:

my-repo/
├── data/
│   ├── raw/
│   └── processed/
├── scripts/
│   └── analysis.R
└── README.md
    • Any necessary information on where data lives (e.g. is it housed in the repo, on a server, in a library / package etc.) and how to access it in order to run the code
    • Consider hyperlinking collaborators’ GitHub profiles or other professional profile
    • In an appropriate, consistent format, including links
    • Provide reference to any other individuals or sources that supported the development of the repository. For example, did you fork an existing repository? Did the work have any funding sources? Were there individuals you consulted with or were inspired by?
    • Don’t forget to add references for data sets too

Things you should consider including, but may vary depending on the goals and complexity of the project:

    • Does your repository contain software that users will need to download or install? Do users access your software via a web browser? Do they need to install any dependencies? Do users need to clone your repository? etc.
    • Related to #1, above. Its important to keep this concise! You may include images. Any long-form instructional documentation is best moved to the repository’s wiki
    • Make mention of GitHub issues and what information a user should include in an issue
    • Do you welcome contributions from others? If so, its important to explain how one might contribute (e.g. fork & pull request, open an issue, both?)
NoteKeep READMEs concise

While it may be tempting to provide as much information as you possibly can into your README, it might not necessarily be the right home for everything (see the Wikis section, below). I find this advice from Kira Oakley in her article, Art of README to be a helpful reminder:

“The lack of a README is a powerful red flag, but even a lengthy README is not indicative of there being high quality. The ideal README is as short as it can be without being any shorter. Detailed documentation is good – make separate pages for it! – but keep your README succinct.”

Example GitHub repository READMEs:

Each project is different and so is its README. As you browse through different repositories you will see that not all of them have the same sections. However, they all offer a clear starting point for a newcomer to understand what the project is about. Here are some GitHub repositories with READMEs we like:

  • strava-dashboard, by Samantha Csik - code for a Shiny dashboard
  • EDS-240-data-viz, by Samantha Csik - code for a course website
  • xarray - a Python package for working with multidimensional arrays and datasets
  • palmerpenguins - an R package that contains teaching data
  • metajam - an R package for downloading and reading in metadata from repositories in the DataONE network
  • awesome-readme, by Matias Singers - a curated list of awesome READMEs

Acknowledgement

This section has been adapted from the Bren School Master in Environmental Data Science README Guidelines https://ucsb-meds.github.io/README-guidelines/.


This work is licensed under CC BY 4.0

UCSB logo