What to not add to Git

Last updated on 2024-07-31 | Edit this page

Overview

Questions

  • What should be included in Git repositories?

Objectives

  • Consider the dos and don’ts of Git usage

What to not add to Git


A final note on what should and shouldn’t be included in Git repositories.

In general, Git can describe individual line changes for any sort of file that may be opened within a text editor. This includes many forms of code, documentation, HTML, simple data files, etc., but excludes other binary formats like: - Microsoft Office documents and other rich text documents
- PDF files
- JPEG/PNG images
- Zip files
- Proprietary data files
- Etc..

Git may still store these files, but any version history would be less meaningful, without clear ‘diffs’.

More importantly though, Git repositories should not be used to store: - Personal information, especially usernames, passwords, keys, secrets
- Details that are specific to an individual computer or system (e.g. use relative paths rather than full system paths)
- Large volumes of data / input files (make use of services like the DAP for these)
- Compiled executables, software libraries, and other files that may be regenerated by scripts when needed

Remember to make use of .gitignore files to ignore and exclude files as necessary.

Key Points

  • Make use of .gitignore to list files to exclude.
  • Don’t commit sensitive, personal or machine-specific information.
  • Don’t commit large data files.
  • Git works best with text files, for which it can track individual line changes.