Search code examples
bashgitgitignore

how to gitignore a file without corrupting the master's gitignore file


I have a script I'm using from my repo's root and I don't want it to appear each time I git status.

I thought of adding it to .gitignore but I don't want this change tracked because I don't want the master's .gitignore to contain this file path (as no one else has it).

Is it possible to gitignore this file in a way my gitignore wouldn't be uploaded when, for example, I git commit -a?


Solution

  • You can use .git/info/exclude to have your non shared ignore rules.

    See this SO answer When would you use .git/info/exclude instead of .gitignore to exclude files?

    And the docu: https://git-scm.com/docs/gitignore