{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifsxa7ublm62ot2ppsdgut2bk7tzl5be4uu2dxiltd6mhtwfxy22u",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mokjuhje32p2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreiaztygcwefjdtdla5nglmxvswllohmvdry5pwopztnceilcz7vwpe"
    },
    "mimeType": "image/webp",
    "size": 59386
  },
  "path": "/nelsonfigueroa/gitignore-isnt-the-only-way-to-ignore-files-in-git-11ll",
  "publishedAt": "2026-06-18T09:17:41.000Z",
  "site": "https://dev.to",
  "tags": [
    "tutorial",
    "beginners",
    "git"
  ],
  "textContent": "I've been using Git for so long and I just realized you can ignore files at three different levels and not just with `.gitignore`. The three files you can use to ignore files are:\n\n  * `.gitignore`\n  * `.git/info/exclude`\n  * `~/.config/git/ignore`\n\n\n\n##  .gitignore\n\n`.gitignore` is the usual file where you write files you want to ignore. It's checked into Git along with the rest of the code. Whatever files you add to it will not get taken into account when running `git` commands.\n\n##  .git/info/exclude\n\nThe `exclude` file lives in the `.git` directory of every Git repository but changes to it are not checked into Git. It usually has a few comment lines on a fresh Git repository. This file is useful for ignoring things on a per-repo basis. For example, you may have a personal `notes.txt` file in a repository that you don't want to check into git but you also don't want to add to `.gitignore` because it's unique to your workflow. In that case you would add `notes.txt` to `.git/info/exclude`.\n\n##  ~/.config/git/ignore\n\nThe `ignore` file lives in your machine's home directory in `~/.config/git/ignore`. Whatever filenames are added to this file are ignored globally at a machine-level. This file is not checked into Git and isn't associated with any particular repository. It's a great place to add files that you want to ignore in every git repository on your computer. For example, if you're on macOS, adding `.DS_Store` here would be ideal.\n\nYou can customize the global ignore file to be a different file. For example, if you want your global git ignore file to be `.gitignore_global` you would run the command:\n\n\n\n    git config --global core.excludesFile ~/.gitignore_global\n\n\nAnd if you ever want to return to the default setting, run:\n\n\n\n    git config --global --unset core.excludesFile\n\n\n##  Checking Which File Is Ignoring a Specific File\n\nWhen adding filenames to any of these, you can use this command to check how a filename is being ignored. For example, if you want to check how `.DS_Store` is being ignored, run `git check-ignore -v .DS_Store` in any Git repository.\n\nHere is the output when the repository's `.gitignore` is ignoring `.DS_Store`:\n\n\n\n    $ git check-ignore -v .DS_Store\n    .gitignore:1:.DS_Store  .DS_Store\n\n\nHere is the output when the repository's `.git/info/exclude` is ignoring `.DS_Store`:\n\n\n\n    $ git check-ignore -v .DS_Store\n    .git/info/exclude:7:.DS_Store   .DS_Store\n\n\nHere is the output when the global `~/.config/git/ignore` file is ignoring `.DS_Store`:\n\n\n\n    $ git check-ignore -v .DS_Store\n    /Users/nelson/.config/git/ignore:2:.DS_Store    .DS_Store\n\n\nAnd here is the output when a custom global ignore file `.gitignore_global` is ignoring `.DS_Store`:\n\n\n\n    $ git check-ignore -v .DS_Store\n    /Users/nelson/.gitignore_global:1:.DS_Store .DS_Store\n\n\nIf there is nothing ignoring a file, the `git check-ignore -v` command produces no output.",
  "title": ".gitignore Isn’t the Only Way To Ignore Files in Git"
}