Git and CI Reference

A lookup reference for .gitignore and .gitattributes patterns, Dockerfile and Compose structure, and GitHub Actions, GitLab CI and Jenkins pipeline shape.

A .gitignore excludes untracked paths; a .gitattributes normalizes line endings, marks binary and LFS files, and hides lockfile diffs. A Dockerfile builds one image; Compose runs several services on a shared network. CI pipelines describe jobs: GitHub Actions keys jobs under `jobs`, GitLab CI lists `stages` with one job per stage, and a declarative Jenkinsfile nests `stages` inside `pipeline`. This reference groups the structure each format expects.

01Quick reference

  • Gitignore: one pattern per line, `#` comments, `!` negates a previous pattern, a trailing `/` matches a directory.
  • Gitattributes: `* text=auto eol=lf` normalizes text; `binary` disables diff and merge; `filter=lfs` routes a file through Git LFS.
  • Dockerfile: instruction order matters for layer caching; use a second stage to keep build tooling out of the runtime image.
  • Compose: services share a network and resolve each other by name; declare every named volume under `volumes:`.
  • GitHub Actions: `on` declares triggers, `jobs.<id>.runs-on` picks the runner, `steps` is an ordered list of `uses` and `run`.
  • GitLab CI: `stages` sets the order and each job names its `stage`; a `when: manual` job waits for a human.
  • Jenkins: a declarative pipeline is `pipeline { agent; stages { … } post { … } }` with no free-form Groovy at the top level.

02Limitations

This reference summarises the file formats and omits project-specific configuration, credential management, supply-chain pinning and runner provisioning.

Frequently asked questions

Why is there no `version:` key in a generated Compose file?
The Compose specification deprecated the top-level `version` key; modern Docker Compose reads the file without it.
Should a generated CI file embed a secret?
No. Reference a secret through the platform's secret store (GitHub secrets, GitLab CI variables, Jenkins credentials) rather than writing a value into the file.

Sources

  1. gitignore(5) — Git documentation — Git project (accessed 2026-10-05)
  2. Dockerfile reference — Docker (accessed 2026-10-05)
  3. Compose specification — Docker (accessed 2026-10-05)
  4. GitHub Actions workflow syntax — GitHub (accessed 2026-10-05)
  5. GitLab CI/CD YAML syntax reference — GitLab (accessed 2026-10-05)