Skip to content

Make the instance a plain repository

$ grim adopt

Projects created before grim adopt existed kept almost nothing in git. The repository tracked grim.json, grim.lock and a .gitignore that ignored everything else, and every module and theme was a git clone of its own. Now a project is a plain git repository: core, modules, themes and your own code are ordinary tracked directories, and only dependencies, .env, storage/, build output and caches stay out.

grim install, update, require, remove, prune and push refuse a project on the old model and point here. grim up, build, deploy and artisan keep working, so a running project is not interrupted. grim adopt converts the project once.

Usage

$ grim adopt
$ git add -A && git commit -m "chore(grim): adopt model A (core 1.3.36)"

Run it from the project root. It needs no network and no login.

Arguments and options

Turn an instance on the old model into a plain git repository (one-off)

Usage

grim adopt

What it actually does

  1. Checks every module and theme clone. Removing a clone's .git keeps its files and loses whatever only the clone knew. So each clone must have no uncommitted changes, and its HEAD must be the commit grim.lock records. If any clone fails the check, grim adopt lists it with the reason and changes nothing. Send the work upstream with grim push or discard it, then run grim adopt again.
  2. Makes the project a repository with git init, if it is not one yet.
  3. Removes the .git of every module and theme. Their files stay and become part of the project.
  4. Replaces .gitignore with the block grim maintains, between # >>> grim and # <<< grim. The old file is kept as .gitignore.bak. Move any line you still need below the block, then delete the backup. From here on, install and update rewrite only the block and never touch your lines outside it.
  5. Prints the commit message to use. grim adopt never commits. The change is the whole project, and you should review it before committing.

Running it a second time changes nothing.

After adopting

  • grim update writes new releases into the working tree as a diff. Local edits are merged three ways, and conflicts are marked the way git marks them.
  • grim push compares a module's directory with the tree of its installed tag and opens the pull request. It commits nothing in the project.
  • A teammate starts with git clone + grim install. Their copy then matches yours, local edits included.