Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions on how to migrate an existing project to using the template #289

Merged
merged 5 commits into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions {{cookiecutter.project_name}}/docs/template_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,44 @@ The following hints may be useful to work with the template sync:
You have reached the end of this document. Congratulations! You have successfully set up your project and are ready to start.
For everything else related to documentation, code style, testing and publishing your project to pypi, please refer to the [contributing docs](contributing.md#contributing-guide).

## Migrate existing projects to using this template

You can also update existing projects to make use of this template to benefit from the latest-greatest
tooling and automated template updates. This requires some manual work though. Here's one way how to do it

1. Let's assume your repository is checked out to `$REPO`
2. Clone your repository a second time to `${REPO}_cookiecutterized`
3. Initialize an empty repository from this cookiecutter template:

```bash
mkdir template && cd template
cruft create https://github.com/scverse/cookiecutter-scverse
```

4. remove everything from the existing repo

```bash
cd ${REPO}_cookiecutterized
git switch -c cookiecutterize
git rm -r "*"
git add -A
git commit -m "clean repo"
```

5. move template over from generated folder

```bash
# move everything, including hidden folders, excluding `.git`.
rsync -av --exclude='.git' ./template/ ./${REPO}_cookiecutterized/
git add -A
git commit -m "init from template"
```

6. Migrate your project: Move over files from `$REPO` to `${REPO}_cookiecutterized`. Omit files that are not
needed anymore and manually merge files where required.

7. Commit your changes. Merge the `cookiecutterize` branch into the main branch, e.g. by making a pull request.

<!-- Links -->

[scanpy developer guide]: https://scanpy.readthedocs.io/en/latest/dev/index.html
Expand Down
Loading