Problem/Motivation
The composer-ready project templates nearly shipped with a .gitignore
that would have caused all the composer-managed files to be excluded from any git repository the owner of the new project might set up. Discussion late in #2982680: Add composer-ready project templates to Drupal core revealed that there are established and opposing schools of thought about whether vendored files should be a part of one's git repository. That .gitignore
was deemed too opinionated for core, and it was just removed entirely with the creation of this follow-on issue to find a more helpful solution.
Excluding any .gitignore
from the official composer-built drupal/recommended-project
project template is very likely to create an immediate chore for users of it, to figure out what is an appropriate .gitignore
for Drupal and get it added to their project.
We would like to provide a .gitignore starting point in our project templates for these two personas:
a) People who deploy site updates using only git, and so require all code to exist in git.
b) People who do not want large quantities of vendored code in their git repository, and develop advanced CI/build artifact systems to deploy site updates.
Proposed resolution
There is currently agreement that there are just two different .gitignore
possibilities to consider, a minimal one similar to the current ./example.gitignore
that excludes things like sites/*/files (but does include composer-added files), and the comprehensive .gitignore
that was removed in #2982680.111.
How we provide the user with these starting-point files exactly is TBD.
We should agree on one of the below high-level resolutions and then nuance that one.
- Add interactivity to our
composer create-project
, such that users are prompted to select the .gitignore appropriate to their persona, or opt out of a .gitignore completely. - Have two differently-named example.thisorthat.gitignore files, neither of which is called
.gitignore
at the project's starting state. - Create more template project variants differentiated by this, e.g.
drupal/recommended-ci-deployed-project
. - Have one well-documented .gitignore with a big commented-out section covering persona b)
Remaining tasks
- Determine high-level solution to use
- Do that one.
- We should probably also remove the extraneous
./web/example.gitignore
file that currently exists in thedrupal/recommended-project
template as part of this .gitignore refinement work.