Skip to content

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.

Creating an Easydata Tracking Branch

Creating the Branch at Project Creation

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:

Creating an easydata Branch 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`

Merging easydata updates into an active project

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

Implementations

This idea has been implemented in code a few different ways:

And see also the discussion here: https://github.com/cookiecutter/cookiecutter/issues/784