From 13994c6527a1189067a961bf02120e39fed6e06e Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 7 Nov 2024 10:10:19 +0000 Subject: [PATCH] Excluding files from Git --- source/_zets/28.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 source/_zets/28.md diff --git a/source/_zets/28.md b/source/_zets/28.md new file mode 100644 index 0000000..9753561 --- /dev/null +++ b/source/_zets/28.md @@ -0,0 +1,15 @@ +--- +title: Excluding local files from Git +date: 2024-11-07 10:10:19 +tags: [git] +--- + +As well as using a shared `.gitignore` file in a directory, I've had a convention of putting my own files I want to ignore in an `.ignored` directory and having that in a [global excludes file](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreexcludesFile). + +This works for most situations, but sometimes files need to be in their expected location and not in a sub-directory. + +I also have scripts that check for a file in both places before performing an action. + +Git, though, has a built-in way to do this. + +Any files added to `.git/info/exclude` will automatically be excluded by Git and because this is in my `.git` directory, it won't affect anyone else's version.