0

I have created a submodule to organise frequently used files from my repositories, to access them using

git submodule add \repo\

I was wondering if I could create an ignore file in this submodule to avoid having to create one each time I make a new repository.

If my folder structure looks like this:

root
│   foo.log
│
└───submodule
        .gitignore

and .gitignore has the following pattern:

*.log

Is it possible to use the .gitignore file in root\submodule\ to ignore the file: foo.log?

If not, is my best option to just copy the .gitignore file into the project manually?

Thanks for your help.

LightninBolt74
  • 211
  • 4
  • 11
  • 3
    Does this answer your question? [git: symlink/reference to a file in an external repository](https://stackoverflow.com/questions/15844542/git-symlink-reference-to-a-file-in-an-external-repository) – CodeCaster Dec 12 '21 at 10:59
  • @CodeCaster oh so would a simlink to the submodule directory be a good solution? I totally forgot about that! – LightninBolt74 Dec 12 '21 at 11:06
  • 1
    @LightninBolt74 Symlink would be a good solution except on a graphical environment that [doesn't properly support symlinks](https://stackoverflow.com/q/5917249/7976758). – phd Dec 12 '21 at 11:33
  • @phd oh so it would be a problem if I use windows and another collaborator uses linux? – LightninBolt74 Dec 12 '21 at 11:39
  • @LightninBolt74 At the mentioned question there are many solutions (cmd and powershell scripts) that replace Git symlinks with Windows symlinks. Then you should check on every commit that you don't commit changes in the symlinks. Is it a problem? That's up to you. – phd Dec 12 '21 at 11:41

0 Answers0