Skip to content

Merging Easydata Changes into a Generated Project

acwooding edited this page Jun 1, 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 cookiecutter-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 cookiecutter-easydata -f --no-input
git add -A .  # This is a little.. YOLO. Really you should inspect the changes manually, delete unneeded files
git commit -m "update from cookiecutter-easydata"

(Note: the config file was previously project_dir/.cookiecutter-easydata.yml)

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

Clone this wiki locally