From 2920234a291f73d53ab5ac326d90a4469a501028 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 29 Jan 2024 22:30:06 +0000 Subject: [PATCH] Add daily email for 2024-01-28 Ignoring things globally --- source/_daily_emails/2024-01-28.md | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 source/_daily_emails/2024-01-28.md diff --git a/source/_daily_emails/2024-01-28.md b/source/_daily_emails/2024-01-28.md new file mode 100644 index 00000000..91b89bfb --- /dev/null +++ b/source/_daily_emails/2024-01-28.md @@ -0,0 +1,37 @@ +--- +title: Ignoring things globally +date: 2024-01-28 +permalink: archive/2024/01/28/ignoring-things-globally +snippet: | + Have you wanted to ignore things globally? Git has a setting for that. +tags: + - software-development + - git +--- + +Yesterday's email was about repository-specific .gitignore files and different ways to write them. + +But there's a setting that most people don't know about, where you can configure a global `.gitignore` file. + +## What I use it for + +Whilst it doesn't replace repository-specific files, it's good for operating system-specific files - such as `.DS_Store` files on macOS. + +I have a convention where I have a `.ignored` directory in a project, and everything in it should be ignored by Git. + +Instead of adding this to every `.gitignore` file, and because it's specific to me, it's a good choice for a global ignore file. + +Anything that affects multiple users - such as ignoring `vendor` or `node_modules` should still be set in each repository. + +## How do you add it? + +Add this to your `~/.gitconfig` or `~/.config/git/config` file to set the path for your global ignore file: + +```plain +[core] + excludesFile = "~/.config/git/ignore" +``` + +Then, create the file and add what you want to ignore everywhere. + +Just remember this is specific to you, and if others have something you've ignored globally and they haven't, they could still add and commit it.