Ignore special repo files in git

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

[origin] .gitignore:

  • foo1. *
  • foo2. *

[other] .gitignore:

  • bar1. *
  • bar2. *

The purpose of this is that we are deploying with git for a managed cloud service, and we would like to keep the dev files in version control, but not push them to the repo.

+4
source share
3 answers

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

(Note that this only affects what is ignored in each repository, it will not affect the files that you actively place under source control and clicking. I do not quite understand your desired use case.)

+6
source

Yes, you may just not have them in the same folder. If you create a new folder, run "expand" and publish the deployment data there, it will use .gitignore in this folder (and not in the root folder).

0
source

Perhaps you could do this using git hooks (scripts in .git). That sounds good.

0
source

Source: https://habr.com/ru/post/1379119/


All Articles