oliverdavies.uk/source/_daily_emails/2024-01-27.md
Oliver Davies 5eba6de81a Update daily email permalinks
This is a follow-up to commit 3be9031de8
as each daily email has a `permalink` value that overrides the default
content type permalink.
2024-05-21 00:03:52 +01:00

40 lines
902 B
Markdown

---
title: gitignore - inclusive or exclusive?
date: 2024-01-27
permalink: daily/2024/01/27/gitignore-inclusive-or-exclusive
snippet: |
How do you write your .gitignore files?
tags:
- software-development
- git
---
Add everything and ignore what you don't want, or ignore everything and explicitly add what you need.
There are two ways to structure a .gitignore file.
The default approach is that all files can be added, and you specify the files and directories you want to ignore.
For example, if my `.gitignore` file was this, these two directories would be ignored:
```language-plain
vendor
web
```
The other approach is to ignore everything and unignore the things to add. For example:
```language-plain
*
!build.yaml
!Dockerfile
!docker-compose.yaml
!web/*/custom
```
Both approaches work and are regularly used.
Which approach do you prefer and why?
Reply and let me know.