Repo specific ignore files in git

Is it possible to have repo specific .gitignore files? Eg:


  • foo1.*
  • foo2.*

[another] .gitignore:

  • bar1.*
  • bar2.*

The purpose behind this is that we deploy using git on to a managed cloud service and we’d like to keep dev files in version control but not push them to a repo.

  • Git: How to remove file from index without deleting files from any repository
  • Do git update-index --assume-unchanged rules propagate to clients on pull?
  • Git ignore sub folders
  • Git - ignore directory when pulling, don't when pushing
  • git: How to ignore all present untracked files?
  • Git Including an arbitrarily nested subfolder when its parent has been excluded in .gitignore
  • Can a git project track a directory listed in my global gitignore?
  • why .gitignore not works?
  • 3 Solutions collect form web for “Repo specific ignore files in git”

    Yes, you can put per repository ignore patterns in .git/info/exclude in each repository.

    (Note, this only affects what is ignored in each repository, it won’t affect files that you actively place under source control and the push. I’m not completely clear on your desired use case.)

    Yes you can, just can’t have them in the same folder. If you create a new folder, day “deploy” and publish your deploy data there, it will use the .gitignore in that folder (not the root one).

    You could probably do this using git hooks (the scripts in .git). post-checkout sounds good.

    Git Baby is a git and github fan, let's start git clone.