Set up a pipeline sync retrospectively
Use this guide to set up a correct TEMPLATE branch for pipelines that were not created with nf-core pipelines create. If you created your pipeline with nf-core pipelines create, your TEMPLATE branch is already configured correctly.
Before proceeding, push all local changes to GitHub and consider making a backup clone of your repository.
Alternatively, consider restarting your pipeline project by running nf-core pipelines create and copying your modifications into the newly created pipeline.
This guide assumes you are working directly with the main nf-core repository. You can also work on your own fork.
Create the TEMPLATE branch
-
Clone your pipeline into a new directory:
mkdir <temp_directory> cd <temp_directory> git clone https://github.com/nf-core/<pipeline_name>.git cd <pipeline_name> -
Create the new
TEMPLATEbranch and delete all files to create a completely empty branch:git checkout --orphan TEMPLATE && git rm -rf '*' -
Verify your branch is completely empty:
git statusYou should see:
On branch TEMPLATE No commits yet nothing to commit (create/copy files and use "git add" to track) -
Regenerate your pipeline from scratch using the most recent template:
nf-core pipelines create --no-gitIf your pipeline already has versioned releases (for example, you are not currently on
1.0dev), specify the version number:nf-core pipelines create --no-git --version 1.3devNoteThe version you choose should match the branch you intend to merge with. If you already have a release, use the version number specified in your
devbranch. -
Follow the prompts to enter the pipeline name, description, and authors. Use the exact text from your existing
nextflow.configfile (manifest.nameetc.). -
Move the newly created template files into your root git directory:
mv nf-core-<pipeline_name>/* . mv nf-core-<pipeline_name>/.[!.]* . rmdir nf-core-<pipeline_name> -
Verify the newly created files are in the correct place:
git statusYou should see output similar to:
On branch TEMPLATE No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) .editorconfig .gitattributes .github/ .gitignore .markdownlint.yml CHANGELOG.md CITATIONS.md CODE_OF_CONDUCT.md LICENSE README.md assets/ bin/ conf/ docs/ lib/ main.nf modules.json modules/ nextflow.config nextflow_schema.json subworkflows/ workflows/ nothing added to commit but untracked files present (use "git add" to track) -
Commit the template files:
git add . git commit -m "Initial template commit" -
Push the
TEMPLATEbranch to the upstream nf-core repository:git push --set-upstream origin TEMPLATE
Merge TEMPLATE into main branches
Merge the TEMPLATE branch into your main pipeline branches. This requires manually resolving all merge conflicts.
-
Check out your development branch and create a new branch for the merge:
git checkout dev git checkout -b template_merge -
Merge the
TEMPLATEbranch:git merge TEMPLATE --allow-unrelated-historiesNoteIf the merge command shows entire files as new, try adding the
-Xignore-space-at-eolflag. -
Resolve merge conflicts. You may see many conflicts:
Auto-merging nextflow.config CONFLICT (add/add): Merge conflict in nextflow.config Auto-merging main.nf CONFLICT (add/add): Merge conflict in main.nf Auto-merging environment.yml CONFLICT (add/add): Merge conflict in environment.yml Auto-merging docs/usage.md CONFLICT (add/add): Merge conflict in docs/usage.mdGo through each file to resolve the merge conflicts. Use a visual merge tool to avoid mistakes when handling many merge markers.
-
Commit and push the resolved changes:
git commit -m "Merged vanilla TEMPLATE branch into main pipeline" git push origin template_merge -
Create a pull request from your
template_mergebranch to the main nf-core repository. -
Once merged into the
devbranch, future automatic template syncs will work correctly. When nf-core releases new versions ofnf-core/tools, pull requests will automatically be created to merge updates into your pipeline.