-
Notifications
You must be signed in to change notification settings - Fork 22
Merging Easydata Changes into a Generated Project
Kjell Wooding edited this page Oct 27, 2021
·
9 revisions
To update the cookiecutter while preserving our local changes, we need to have a branch that tracks the bare easydata template.
Usually, we create this branch when we first create the environment; e.g.
make create_environment
conda activate ${PROJECT_NAME}
git init
git add .
git commit -m 'initial import'
git branch easydata # branch for future easydata upgrades
If we didn't do this, it can still be created after the fact:
To verify that your branch does (or doesn't exist), obtain is SHA-1 hash via:
git rev-parse -q --verify easydata
If no output is given from the above , we will need to create this branch. To do so:
git branch easydata `git rev-list --max-parents=0 HEAD`
Merge the easydata changes into the easydata
branch:
git checkout easydata # or git workdir ...
cd .. && cookiecutter --config-file project_dir/.easydata.yml easydata -f --no-input
git add -p ... # Check what's changed and add the changes. Note: deletions must be done manually using 'git rm'
git commit -m "update from easydata project"
Finally, merge the changes into your working branch
git checkout main
git merge easydata
This idea has been implemented in code a few different ways:
- Cookiecutter PR#1173
- https://github.com/senseyeio/cupper (based on the below)
-
https://github.com/aroig/cookiecutter-latex-paper/blob/master/%7B%7Bcookiecutter.project_slug%7D%7D/make/cookiecutter-update.py (uses
update-template target, below
) -
https://github.com/aroig/cookiecutter-latex-paper/blob/master/%7B%7Bcookiecutter.project_slug%7D%7D/Makefile (see
update-template
target)
And see also the discussion here: https://github.com/cookiecutter/cookiecutter/issues/784