0

I often have extra files that I want to gitignore but I don't want to push the .gitignore with my ignores in it since it pollutes the team's code repo as those ignore are technically just for.

Is there a way to have a local ignore just for me?

xiaodai
  • 14,889
  • 18
  • 76
  • 140
  • 2
    https://stackoverflow.com/questions/653454/how-do-you-make-git-ignore-files-without-using-gitignore – Niloct Mar 22 '21 at 01:30
  • 2
    See [this response](https://stackoverflow.com/a/653489/421195): "There are three ways to tell Git which files to ignore - `.gitignore` files, 2) `$GIT_DIR/.git/info/exclude`, 3) Files pointed to via the `core.excludesfile` setting. – paulsm4 Mar 22 '21 at 01:31

1 Answers1

0

Yes, there are two options for this. This is a great option for files that are specific to your situation, such as editor-specific files, that you want to ignore but aren't universally applicable

If the files you want to ignore are specific to your project, you can use .git/info/exclude. That's specific to your repo.

If the files you want to ignore are general across all repos, you can use core.excludesFile, which defaults to ~/.config/git/ignore.

You can see both of these uses with git help gitignore.

bk2204
  • 64,793
  • 6
  • 84
  • 100