7

I develop a core for our Nette web projects. The core is injected as a library. Although I want to be able to test and try the functionalities of the core project without injecting it. So I had to add files needed to start the core project separately. This is really helpful while trying out new features, but I do not want to include these files in a release (but still be able to share on git, so colleagues can try it, too).

Are there any good practices how to deal with this situation?

I only found two options:

  1. Do not commit these files into Git repository and share the files with colleagues through other repository - but here comes the compatibility problems.
  2. Commit these files to Git and have a separate branch for release in which these files are deleted.
Martin Pohorský
  • 431
  • 3
  • 15
  • What's wrong with your branch solution? It looks good and easy to manage to me. – kabanus Apr 27 '18 at 09:44
  • Sub-Modules? See this https://git-scm.com/book/en/v2/Git-Tools-Submodules – Yogesh_D Apr 27 '18 at 09:44
  • To be honest I have a terrible experience with sub-modules. [Why your company shouldn't use git submodules](https://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules) may be worth a read. – kabanus Apr 27 '18 at 09:47
  • I have the same experience as @kabanus. Submodules aren't the best solution (http://slopjong.de/2013/06/04/git-why-submodules-are-evil/) – M. Twarog Apr 27 '18 at 13:06

1 Answers1

13

You may use export-ignore feature for this. Add this to your .gitattributes file:

/path/to/file/or/directory export-ignore

export-ignore

Files and directories with the attribute export-ignore won’t be added to archive files. See gitattributes for details.

rob006
  • 21,383
  • 5
  • 53
  • 74