From 8a8cbba4df55edc58ae9ec6d797a5d6bc0d15af3 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 28 Jan 2024 22:58:35 +0000 Subject: [PATCH] Add daily email for 2024-01-27 gitignore - inclusive or exclusive? --- source/_daily_emails/2024-01-27.md | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 source/_daily_emails/2024-01-27.md diff --git a/source/_daily_emails/2024-01-27.md b/source/_daily_emails/2024-01-27.md new file mode 100644 index 00000000..3aa010e4 --- /dev/null +++ b/source/_daily_emails/2024-01-27.md @@ -0,0 +1,39 @@ +--- +title: gitignore - inclusive or exclusive? +date: 2024-01-27 +permalink: archive/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: + +```plain +vendor +web +``` + +The other approach is to ignore everything and unignore the things to add. For example: + +```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.